Part Number Hot Search : 
MIC5015 ISL28 N5945 HT45F5R LM6402A AK4183 TA0102A AP3102
Product Description
Full Text Search
 

To Download 78F9116A Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  user? manual printed in japan 8-bit single-chip microcontrollers document no. u14643ej1v0um00 (1st edition) date published june 2000 ns cp(k) 2000 m pd789104a, 789114a, 789124a, 789134a subseries m pd789101a m pd789121a m pd789102a m pd789122a m pd789104a m pd789124a m pd789111a m pd789131a m pd789112a m pd789132a m pd789114a m pd789134a m pd78F9116A m pd78f9136a m pd789101a(a) m pd789121a(a) m pd789102a(a) m pd789122a(a) m pd789104a(a) m pd789124a(a) m pd789111a(a) m pd789131a(a) m pd789112a(a) m pd789132a(a) m pd789114a(a) m pd789134a(a) .com .com .com 4 .com u datasheet
2 users manual u14643ej1v0um00 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 3 eeprom is a trademark of nec corporation. windows and windows nt are either registered trademarks or trademarks of microsoft corporation in the united states and/or other countries. pc/at is a trademark of international business machines corporation. hp9000 series 700 and hp-ux are trademarks of hewlett-packard company. sparcstation is a trademark of sparc international, inc. solaris and sunos are trademarks of sun-microsystems, inc. osf/motif is a trademark of open software foundation, inc. news and news-os are trademarks of sony corporation. tron is an abbreviation of the realtime operating system nucleus. itron is an abbreviation of industrial tron. 1 notes for cmos devices precaution against esd for semiconductors note: strong electric field, when exposed to a mos device, can cause destruction of the gate oxide and ultimately degrade the device operation. steps must be taken to stop generation of static electricity as much as possible, and quickly dissipate it once, when it has occurred. environmental control must be adequate. when it is dry, humidifier should be used. it is recommended to avoid using insulators that easily build static electricity. semiconductor devices must be stored and transported in an anti-static container, static shielding bag or conductive material. all test and measurement tools including work bench and floor should be grounded. the operator should be grounded using wrist strap. semiconductor devices must not be touched with bare hands. similar precautions need to be taken for pw boards with semiconductor devices on it. 2 handling of unused input pins for cmos note: no connection for cmos device inputs can be cause of malfunction. if no connection is provided to the input pins, it is possible that an internal input level may be generated due to noise, etc., hence causing malfunction. cmos devices behave differently than bipolar or nmos devices. input levels of cmos devices must be fixed high or low by using a pull-up or pull-down circuitry. each unused pin should be connected to v dd or gnd with a resistor, if it is considered to have a possibility of being an output pin. all handling related to the unused pins must be judged device by device and related specifications governing the devices. 3 status before initialization of mos devices note: power-on does not necessarily define initial status of mos device. production process of mos does not define the initial operation status of the device. immediately after the power source is turned on, the devices with reset function have not yet been initialized. hence, power-on does not guarantee out-pin levels, i/o settings or contents of registers. device is not initialized until the reset signal is received. reset operation must be executed immediately after power-on for devices having reset function. .com .com .com .com 4 .com u datasheet
4 users manual u14643ej1v0um00 the export of these products from japan is regulated by the japanese government. the export of some or all of these products may be prohibited without governmental license. to export or re-export some or all of these products from a country other than japan may also be prohibited without a license from that country. please call an nec sales representative. licence not needed: m pd78F9116A, 78f9136a the customer must judge the need for license: m pd789101a, 789102a, 789104a, 789101a(a), 789102a(a), 789104a(a) m pd789111a, 789112a, 789114a, 789111a(a), 789112a(a), 789114a(a) m pd789121a, 789122a, 789124a, 789121a(a), 789122a(a), 789124a(a) m pd789131a, 789132a, 789134a, 789131a(a), 789132a(a), 789134a(a) m8e 00. 4 the information in this document is current as of june, 2000. the information is subject to change without notice. for actual design-in, refer to the latest publications of nec's data sheets or data books, etc., for the most up-to-date specifications of nec semiconductor products. not all products and/or types are available in every country. please check with an nec sales representative for availability and additional information. no part of this document may be copied or reproduced in any form or by any means without prior written consent of nec. nec assumes no responsibility for any errors that may appear in this document. nec does not assume any liability for infringement of patents, copyrights or other intellectual property rights of third parties by or arising from the use of nec semiconductor products listed in this document or any other liability arising from the use of such products. no license, express, implied or otherwise, is granted under any patents, copyrights or other intellectual property rights of nec or others. descriptions of circuits, software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples. the incorporation of these circuits, software and information in the design of customer's equipment shall be done under the full responsibility of customer. nec assumes no responsibility for any losses incurred by customers or third parties arising from the use of these circuits, software and information. while nec endeavours to enhance the quality, reliability and safety of nec semiconductor products, customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. to minimize risks of damage to property or injury (including death) to persons arising from defects in nec semiconductor products, customers must incorporate sufficient safety measures in their design, such as redundancy, fire-containment, and anti-failure features. nec semiconductor products are classified into the following three quality grades: "standard", "special" and "specific". the "specific" quality grade applies only to semiconductor products developed based on a customer-designated "quality assurance program" for a specific application. the recommended applications of a semiconductor product depend on its quality grade, as indicated below. customers must check the quality grade of each semiconductor product before using it in a particular application. "standard": computers, office equipment, communications equipment, test and measurement equipment, audio and visual equipment, home electronic appliances, machine tools, personal electronic equipment and industrial robots "special": transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster systems, anti-crime systems, safety equipment and medical equipment (not specifically designed for life support) "specific": aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life support systems and medical equipment for life support, etc. the quality grade of nec semiconductor products is "standard" unless otherwise expressly specified in nec's data sheets or data books, etc. if customers wish to use nec semiconductor products in applications not intended by nec, they must contact an nec sales representative in advance to determine nec's willingness to support a given application. (note) (1) "nec" as used in this statement means nec corporation and also includes its majority-owned subsidiaries. (2) "nec semiconductor products" means any semiconductor product developed or manufactured by or for nec (as defined above). .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 5 regional information some information contained in this document may vary from country to country. before using any nec product in your application, piease contact the nec office in your country to obtain a list of authorized representatives and distributors. they will verify: device availability ordering information product release schedule availability of related technical literature development environment specifications (for example, specifications for third-party tools and components, host computers, power plugs, ac supply voltages, and so forth) network requirements in addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary from country to country. nec electronics inc. (u.s.) santa clara, california tel: 408-588-6000 800-366-9782 fax: 408-588-6130 800-729-9288 nec electronics (germany) gmbh duesseldorf, germany tel: 0211-65 03 02 fax: 0211-65 03 490 nec electronics (uk) ltd. milton keynes, uk tel: 01908-691-133 fax: 01908-670-290 nec electronics italiana s.r.l. milano, italy tel: 02-66 75 41 fax: 02-66 75 42 99 nec electronics (germany) gmbh benelux office eindhoven, the netherlands tel: 040-2445845 fax: 040-2444580 nec electronics (france) s.a. velizy-villacoublay, france tel: 01-30-67 58 00 fax: 01-30-67 58 99 nec electronics (france) s.a. spain office madrid, spain tel: 91-504-2787 fax: 91-504-2860 nec electronics (germany) gmbh scandinavia office taeby, sweden tel: 08-63 80 820 fax: 08-63 80 388 nec electronics hong kong ltd. hong kong tel: 2886-9318 fax: 2886-9022/9044 nec electronics hong kong ltd. seoul branch seoul, korea tel: 02-528-0303 fax: 02-528-4411 nec electronics singapore pte. ltd. united square, singapore 1130 tel: 65-253-8311 fax: 65-250-3583 nec electronics taiwan ltd. taipei, taiwan tel: 02-2719-2377 fax: 02-2719-5951 nec do brasil s.a. electron devices division rodovia presidente dutra, km 214 07210-902-guarulhos-sp brasil tel: 55-11-6465-6810 fax: 55-11-6465-6829 j99.1 .com .com .com .com 4 .com u datasheet
6 users manual u14643ej1v0um00 [memo] .com .com .com .com 4 .com u datasheet
7 users manual u14643ej1v0um00 introduction target readers this manual is intended for users who wish to understand the functions of the m pd789104a, 789114a, 789124a, 789134a subseries and to design and develop application systems and programs using these microcontrollers. the target devices are shown as follows: ? m pd789104a subseries: m pd789101a, 789102a, 789104a, m pd789101a(a), 789102a(a), 789104a(a) ? m pd789114a subseries: m pd789111a, 789112a, 789114a, 78F9116A, m pd789111a(a), 789112a(a), 789114a(a) ? m pd789124a subseries: m pd789121a, 789122a, 789124a, m pd789121a(a), 789122a(a), 789124a(a) ? m pd789134a subseries: m pd789131a, 789132a, 789134a, 78f9136a, m pd789131a(a), 789132a(a), 789134a(a) the m pd789104a/114a/124a/134a subseries is a generic term for all the target devices in this manual. the oscillation frequency of the system clock is regarded as f x for ceramic/crystal oscillation ( m pd789104a and 789114a subseries), and regarded as f cc for an rc oscillation ( m pd789124a and 789134a subseries). purpose this manual is intended for users to understand the functions described in the organization below. organization the m pd789104a, 789114a, 789124a, 789134a subseries user's manual is divided into two parts: this manual and instructions (common to the 78k/0s series). m pd789104a,789114a,789124a, 78k/0s series 789134a subseries users manual users manual (this manual) instructions ? pin functions ? cpu function ? internal block functions ? instruction set ? interrupt ? instruction description ? other internal peripheral functions .com .com .com .com 4 .com u datasheet
8 users manual u14643ej1v0um00 how to read this manual it is assumed that the readers of this manual have general knowledge in the fields of electrical engineering, logic circuits, and microcontrollers. for users who use this document as the manual for the m pd789101a(a), 789102a(a), 789104a(a), 789111a(a), 789112a(a), 789114a(a), 789121a(a), 789122a(a), 789124a(a), 789131a(a), 789132a(a), and 789134a(a) ? the only differences between standard products and (a) products are the quality grades and the electrical specifications. (refer to 1.9 differences between standard quality grade products and (a) products and 2.9 differences between standard quality grade products and (a) products ). for the (a) products, read the part numbers in the following manner. m pd789101a ? m pd789101a(a) m pd789121a ? m pd789121a(a) m pd789102a ? m pd789102a(a) m pd789122a ? m pd789122a(a) m pd789104a ? m pd789104a(a) m pd789124a ? m pd789124a(a) m pd789111a ? m pd789111a(a) m pd789131a ? m pd789131a(a) m pd789112a ? m pd789112a(a) m pd789132a ? m pd789132a(a) m pd789114a ? m pd789114a(a) m pd789134a ? m pd789134a(a) to understand the overall functions in general ? read this manual in the order of the contents . how to interpret register formats ? the name ?v a bit whose number is encircled is reserved for the assembler and is defined for the c compiler by the header file sfrbit.h . to learn the detailed functions of a register whose register name is known ? refer to appendix c register index . to learn the details of the instruction functions of the 78k/0s series ? refer to 78k/0s series users manual instructions (u11047e) . to know the electrical specifications of the m pd789104a/114a/124a/134a subseries ? refer to separately available data sheet. caution the application examples in this manual are created for "standard" quality grade products for general electric equipment. when using the application examples in this manual for purposes which require "special" quality grades, thoroughly examine the quality grade of each part and circuit actually used. conventions data significance: higher digits on the left and lower digits on the right active low representation: (overscore over pin or signal name) note : footnote for item marked with note in the text caution : information requiring particular attention remark : supplementary information numerical representation: binary ... or b decimal ... hexadecimal ... h .com .com .com .com 4 .com u datasheet
9 users manual u14643ej1v0um00 related documents the related documents indicated in this publication may include preliminary versions. however, preliminary versions are not marked as such. documents related to devices document name document no. english japanese m pd789101a,102a,104a,111a,112a,114a,101a(a),102a(a),104a(a),111a(a), u14590e u14590j 112a(a),114a(a) data sheet m pd789121a,122a,124a,131a,132a,134a,121a(a),122a(a),124a(a),131a(a), u14678e u14678j 132a(a),134a(a) data sheet m pd78F9116A data sheet u14667e u14667j m pd78f9136a data sheet u14690e u14690j m pd789104a,789114a,789124a,789134a subseries users manual this manual u14643j 78k/0s series users manual instruction u11047e u11047j 78k/0, 78k/0s series application note flash memory write u14458e u14458j documents related to development tools (users manuals) document name document no. english japanese ra78k0s assembler package operation u11622e u11622j assembly language u11599e u11599j structured assembly language u11623e u11623j cc78k0s c compiler operation u11816e u11816j language u11817e u11817j sm78k0s system simulator windows tm based reference u11489e u11489j sm78k series system simulator external components user open u10092e u10092j interface specification id78k0s-ns integrated debugger reference u12901e u12901j windows based ie-78k0s-ns in-circuit emulator u13549e u13549j ie-789136-ns-em1 emulation board u14363e u14363j caution the related documents listed above are subject to change without notice. be sure to use the latest version of each document for designing. .com .com .com .com 4 .com u datasheet
10 users manual u14643ej1v0um00 document related to embedded software (users manual) document name document no. english japanese 78k/0s series os mx78k0s basics u12938e u12938j other documents document name document no. english japanese semiconductor selection guide products & packages (cd-rom) x13769x semiconductor device mounting technology manual c10535e c10535j quality grades on nec semiconductor devices c11531e c11531j nec semiconductor device reliability/quality control system c10983e c10983j guide to prevent damage for semiconductor devices by electrostatic discharge (esd) c11892e c11892j guide to microcomputer-related products by third party ? u11416j caution the related documents listed above are subject to change without notice. be sure to use the latest version of each document for designing. .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 11 contents chapter 1 general ( m pd789104a, 789114a subseries) ................................................... 23 1.1 features ............................................................................................................................... 23 1.2 applications ........................................................................................................................ 23 1.3 ordering information ......................................................................................................... 24 1.4 quality grade ...................................................................................................................... 24 1.5 pin configuration (top view) ........................................................................................... 25 1.6 78k/0s series lineup ........................................................................................................ 26 1.7 block diagram .................................................................................................................... 28 1.8 outline of functions .......................................................................................................... 29 1.9 differences between standard quality grade products and (a) products ............... 30 chapter 2 general ( m pd789124a, 789134a subseries) ................................................... 31 2.1 features ............................................................................................................................... 31 2.2 applications ........................................................................................................................ 31 2.3 ordering information ......................................................................................................... 32 2.4 quality grade ...................................................................................................................... 32 2.5 pin configuration (top view) ........................................................................................... 33 2.6 78k/0s series lineup ........................................................................................................ 34 2.7 block diagram .................................................................................................................... 36 2.8 outline of functions .......................................................................................................... 37 2.9 differences between standard quality grade products and (a) products ............... 38 chapter 3 pin functions ......................................................................................................... 39 3.1 pin function list ................................................................................................................ 39 3.2 description of pin functions ........................................................................................... 41 3.2.1 p00 to p03 (port 0) .................................................................................................................. 41 3.2.2 p10, p11 (port 1) ...................................................................................................................... 41 3.2.3 p20 to p25 (port 2) .................................................................................................................. 41 3.2.4 p50 to p53 (port 5) .................................................................................................................. 42 3.2.5 p60 to p63 (port 6) .................................................................................................................. 42 3.2.6 reset ............................................................................................................................... ....... 42 3.2.7 x1, x2 ( m pd789104a, 789114a subseries) ........................................................................... 42 3.2.8 cl1, cl2 ( m pd789124a, 789134a subseries) ....................................................................... 42 3.2.9 av dd ............................................................................................................................. .................................................................................. 42 3.2.10 av ss ............................................................................................................................. ................................................................................ 42 3.2.11 v dd ............................................................................................................................. ................................................................................... 42 3.2.12 v ss ............................................................................................................................. ................................................................................... 42 3.2.13 v pp ( m pd78F9116A, 78f9136a only) .................................................................................... 43 3.2.14 ic0 (pin no.20) (mask rom version only) ............................................................................ 43 3.2.15 ic0 (pins no.10 and no.21) ................................................................................................... 43 3.3 pin input/output circuits and recommended connection of unused pins ............. 44 chapter 4 cpu architecture ................................................................................................ 47 4.1 memory space .................................................................................................................... 47 4.1.1 internal program memory space .............................................................................................. 51 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 12 4.1.2 internal data memory (internal high-speed ram) space ........................................................ 52 4.1.3 special function register (sfr) area ....................................................................................... 52 4.1.4 data memory addressing ......................................................................................................... 52 4.2 processor registers .......................................................................................................... 56 4.2.1 control registers ....................................................................................................................... 56 4.2.2 general registers ...................................................................................................................... 59 4.2.3 special function registers (sfrs) ............................................................................................ 60 4.3 instruction address addressing ...................................................................................... 63 4.3.1 relative addressing .................................................................................................................. 63 4.3.2 immediate addressing .............................................................................................................. 64 4.3.3 table indirect addressing ......................................................................................................... 65 4.3.4 register addressing ................................................................................................................. 65 4.4 operand address addressing .......................................................................................... 66 4.4.1 direct addressing ..................................................................................................................... 66 4.4.2 short direct addressing ............................................................................................................ 67 4.4.3 special function register (sfr) addressing ............................................................................ 68 4.4.4 register addressing ................................................................................................................. 69 4.4.5 register indirect addressing .................................................................................................... 70 4.4.6 based addressing ..................................................................................................................... 71 4.4.7 stack addressing ...................................................................................................................... 71 chapter 5 port functions ..................................................................................................... 73 5.1 functions of ports ............................................................................................................. 73 5.2 port configuration ............................................................................................................. 75 5.2.1 port 0 ............................................................................................................................... ......... 75 5.2.2 port 1 ............................................................................................................................... ......... 76 5.2.3 port 2 ............................................................................................................................... ......... 77 5.2.4 port 5 ............................................................................................................................... ......... 81 5.2.5 port 6 ............................................................................................................................... ......... 82 5.3 port function control registers ...................................................................................... 83 5.4 operation of port functions ............................................................................................. 85 5.4.1 writing to i/o port ..................................................................................................................... 85 5.4.2 reading from i/o port .............................................................................................................. 85 5.4.3 arithmetic operation of i/o port ................................................................................................ 86 chapter 6 clock generator ( m pd789104a, 789114a subseries) ............................... 87 6.1 function of clock generator ............................................................................................ 87 6.2 configuration of clock generator ................................................................................... 87 6.3 register controlling clock generator ............................................................................ 88 6.4 system clock oscillator .................................................................................................... 89 6.4.1 system clock oscillator ............................................................................................................. 89 6.4.2 divider ............................................................................................................................... ........ 92 6.5 operation of clock generator .......................................................................................... 92 6.6 changing setting of cpu clock ....................................................................................... 93 6.6.1 time required for switching cpu clock ................................................................................... 93 6.6.2 switching cpu clock ................................................................................................................ 93 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 13 chapter 7 clock generator ( m pd789124a, 789134a subseries) ............................... 95 7.1 function of clock generator ............................................................................................ 95 7.2 configuration of clock generator ................................................................................... 95 7.3 register controlling clock generator ............................................................................ 96 7.4 system clock oscillator .................................................................................................... 97 7.4.1 system clock oscillator ............................................................................................................. 97 7.4.2 divider ............................................................................................................................... ........ 100 7.5 operation of clock generator .......................................................................................... 100 7.6 changing setting of cpu clock ....................................................................................... 101 7.6.1 time required for switching cpu clock ................................................................................... 101 7.6.2 switching cpu clock ................................................................................................................ 101 chapter 8 16-bit timer 20 .......................................................................................................... 103 8.1 16-bit timer 20 functions ................................................................................................. 103 8.2 16-bit timer 20 configuration .......................................................................................... 104 8.3 registers controlling 16-bit timer 20 ............................................................................. 106 8.4 16-bit timer 20 operation ................................................................................................. 109 8.4.1 operation as timer interrupt ..................................................................................................... 109 8.4.2 operation as timer output ........................................................................................................ 111 8.4.3 capture operation ..................................................................................................................... 112 8.4.4 16-bit timer counter 20 readout ............................................................................................... 113 chapter 9 8-bit timer/event counter 80 .......................................................................... 115 9.1 functions of 8-bit timer/event counter 80 .................................................................... 115 9.2 8-bit timer/event counter 80 configuration .................................................................. 116 9.3 8-bit timer/event counter 80 control registers ........................................................... 118 9.4 operation of 8-bit timer/event counter 80 .................................................................... 120 9.4.1 operation as interval timer ....................................................................................................... 120 9.4.2 operation as external event counter ....................................................................................... 122 9.4.3 operation as square wave output ........................................................................................... 123 9.4.4 operation as pwm output ........................................................................................................ 125 9.5 notes on using 8-bit timer/event counter 80 ............................................................... 127 chapter 10 watchdog timer .................................................................................................. 129 10.1 functions of watchdog timer ........................................................................................ 129 10.2 configuration of watchdog timer ................................................................................. 130 10.3 watchdog timer control register ................................................................................. 131 10.4 operation of watchdog timer ........................................................................................ 133 10.4.1 operation as watchdog timer ................................................................................................. 133 10.4.2 operation as interval timer .................................................................................................... 134 chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) .......................... 135 11.1 8-bit a/d converter functions ....................................................................................... 135 11.2 8-bit a/d converter configuration ................................................................................. 135 11.3 registers controlling 8-bit a/d converter ................................................................... 138 11.4 8-bit a/d converter operation ....................................................................................... 140 11.4.1 basic operation of 8-bit a/d converter ................................................................................... 140 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 14 11.4.2 input voltage and conversion result ....................................................................................... 141 11.4.3 operation mode of 8-bit a/d converter .................................................................................. 143 11.5 cautions related to 8-bit a/d converter ...................................................................... 144 chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) ........................ 149 12.1 10-bit a/d converter functions ..................................................................................... 149 12.2 10-bit a/d converter configuration .............................................................................. 149 12.3 registers controlling 10-bit a/d converter ................................................................. 152 12.4 10-bit a/d converter operation ..................................................................................... 154 12.4.1 basic operation of 10-bit a/d converter ................................................................................ 154 12.4.2 input voltage and conversion result ...................................................................................... 155 12.4.3 operation mode of 10-bit a/d converter ............................................................................... 157 12.5 cautions related to 10-bit a/d converter .................................................................... 158 chapter 13 serial interface 20 ........................................................................................... 163 13.1 functions of serial interface 20 ..................................................................................... 163 13.2 serial interface 20 configuration ................................................................................... 163 13.3 serial interface 20 control registers ............................................................................. 167 13.4 serial interface 20 operation ......................................................................................... 174 13.4.1 operation stop mode .............................................................................................................. 174 13.4.2 asynchronous serial interface (uart) mode ........................................................................ 176 13.4.3 3-wire serial i/o mode ............................................................................................................ 189 chapter 14 multiplier .............................................................................................................. 199 14.1 multiplier function ........................................................................................................... 199 14.2 multiplier configuration .................................................................................................. 199 14.3 multiplier control register ............................................................................................. 201 14.4 multiplier operation ......................................................................................................... 202 chapter 15 interrupt functions ........................................................................................ 203 15.1 interrupt function types ................................................................................................. 203 15.2 interrupt sources and configuration ............................................................................ 203 15.3 interrupt function control registers ............................................................................ 206 15.4 interrupt processing operation ..................................................................................... 211 15.4.1 non-maskable interrupt request acknowledgement operation ............................................. 211 15.4.2 maskable interrupt request acknowledgement operation ..................................................... 213 15.4.3 multiple interrupt processing .................................................................................................. 215 15.4.4 interrupt request reserve ....................................................................................................... 217 chapter 16 standby function .............................................................................................. 219 16.1 standby function and configuration ............................................................................ 219 16.1.1 standby function ..................................................................................................................... 219 16.1.2 standby function control register ( m pd789104a, 789114a subseries) ............................... 220 16.2 operation of standby function ...................................................................................... 221 16.2.1 halt mode ............................................................................................................................. 22 1 16.2.2 stop mode ............................................................................................................................ 224 chapter 17 reset function ................................................................................................... 227 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 15 chapter 18 m pd78F9116A, 78f9136a ........................................................................................ 231 18.1 flash memory programming .......................................................................................... 232 18.1.1 selecting communication mode ............................................................................................. 232 18.1.2 function of flash memory programming ................................................................................ 233 18.1.3 flashpro iii connection example ........................................................................................... 233 18.1.4 example of settings for flashpro iii (pg-fp3) ....................................................................... 237 chapter 19 mask option (mask rom version) ................................................................ 239 chapter 20 instruction set .................................................................................................. 241 20.1 operation ........................................................................................................................... 241 20.1.1 operand identifiers and description methods ....................................................................... 241 20.1.2 description of operation column ......................................................................................... 242 20.1.3 description of flag operation column .................................................................................. 242 20.2 operation list ................................................................................................................... 243 20.3 instructions listed by addressing type ....................................................................... 248 appendix a development tools ........................................................................................... 251 a.1 language processing software ...................................................................................... 253 a.2 flash memory writing tools ............................................................................................ 254 a.3 debugging tools ................................................................................................................ 254 a.3.1 hardware ............................................................................................................................... ... 254 a.3.2 software ............................................................................................................................... .... 255 appendix b embedded software ......................................................................................... 257 appendix c register index ...................................................................................................... 259 c.1 register name index (alphabetic order) ....................................................................... 259 c.2 register symbol index (alphabetic order) .................................................................... 261 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 16 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 17 list of figures (1/4) figure no. title page 3-1. pin input/output circuits .................................................................................................................... 45 4-1. memory map ( m pd789101a, 789111a, 789121a, 789131a) ........................................................... 47 4-2. memory map ( m pd789102a, 789112a, 789122a, 789132a) ........................................................... 48 4-3. memory map ( m pd789104a, 789114a, 789124a, 789134a) ........................................................... 49 4-4. memory map ( m pd78F9116A, 78f9136a) ......................................................................................... 50 4-5. data memory addressing ( m pd789101a, 789111a, 789121a, 789131a) ....................................... 52 4-6. data memory addressing ( m pd789102a, 789112a, 789122a, 789132a) ....................................... 53 4-7. data memory addressing ( m pd789104a, 789114a, 789124a, 789134a) ....................................... 54 4-8. data memory addressing ( m pd78F9116A, 78f9136a) .................................................................... 55 4-9. program counter configuration ......................................................................................................... 56 4-10. program status word configuration .................................................................................................. 56 4-11. stack pointer configuration ................................................................................................................ 58 4-12. data to be saved to stack memory ................................................................................................... 58 4-13. data to be restored from stack memory .......................................................................................... 58 4-14. general register configuration .......................................................................................................... 59 5-1. port types ............................................................................................................................... ............ 73 5-2. block diagram of p00 to p03 ............................................................................................................. 75 5-3. block diagram of p10 and p11 .......................................................................................................... 76 5-4. block diagram of p20 ......................................................................................................................... 77 5-5. block diagram of p21 ......................................................................................................................... 78 5-6. block diagram of p22, p23, and p25 ................................................................................................ 79 5-7. block diagram of p24 ......................................................................................................................... 80 5-8. block diagram of p50 to p53 ............................................................................................................. 81 5-9. block diagram of p60 to p63 ............................................................................................................. 82 5-10. port mode register format ................................................................................................................ 84 5-11. pull-up resistor option register 0 format ....................................................................................... 84 5-12. pull-up resistor option register b2 format ..................................................................................... 84 6-1. block diagram of clock generator .................................................................................................... 87 6-2. processor clock control register format ......................................................................................... 88 6-3. external circuit of system clock oscillator ....................................................................................... 89 6-4. examples of incorrect resonator connection ................................................................................... 90 6-5. switching cpu clock .......................................................................................................................... 93 7-1. block diagram of clock generator .................................................................................................... 95 7-2. processor clock control register format ......................................................................................... 96 7-3. external circuit of system clock oscillator ....................................................................................... 97 7-4. examples of incorrect resonator connection ................................................................................... 98 7-5. switching cpu clock .......................................................................................................................... 101 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 18 list of figures (2/4) figure no. title page 8-1. block diagram of 16-bit timer 20 ...................................................................................................... 104 8-2. 16-bit timer mode control register 20 format ................................................................................ 107 8-3. port mode register 2 format ............................................................................................................. 108 8-4. settings of 16-bit timer mode control register 20 at timer interrupt operation ........................... 109 8-5. timing of timer interrupt operation ................................................................................................... 110 8-6. settings of 16-bit timer mode control register 20 at timer output operation .............................. 111 8-7. timer output timing ........................................................................................................................... 111 8-8. settings of 16-bit timer mode control register 20 at capture operation ...................................... 112 8-9. capture operation timing (both edges of cpt20 pin are specified) ............................................. 112 8-10. 16-bit timer counter 20 readout timing .......................................................................................... 113 9-1. block diagram of 8-bit timer/event counter 80 ............................................................................... 117 9-2. 8-bit timer mode control register 80 format .................................................................................. 118 9-3. port mode register 2 format ............................................................................................................. 119 9-4. interval timer operation timing ......................................................................................................... 121 9-5. external event counter operation timing (with rising edge specified) ......................................... 122 9-6. square wave output timing .............................................................................................................. 124 9-7. pwm output timing ............................................................................................................................ 126 9-8. start timing of 8-bit timer counter ................................................................................................... 127 9-9. external event counter operation timing ......................................................................................... 127 10-1 block diagram of watchdog timer ..................................................................................................... 130 10-2 timer clock select register 2 format ............................................................................................... 131 10-3 format of watchdog timer mode register ........................................................................................ 132 11-1. block diagram of 8-bit a/d converter ............................................................................................... 136 11-2. format of a/d converter mode register 0 ........................................................................................ 138 11-3. format of analog input channel specification register 0 ................................................................ 139 11-4. basic operation of 8-bit a/d converter ............................................................................................. 141 11-5. relationships between analog input voltage and a/d conversion result ...................................... 142 11-6. software-started a/d conversion ...................................................................................................... 143 11-7. how to reduce current consumption in standby mode .................................................................. 144 11-8. conversion result readout timing (when conversion result is undefined value) ...................... 145 11-9. conversion result readout timing (when conversion result is normal value) ........................... 145 11-10. analog input pin treatment ................................................................................................................ 146 11-11. a/d conversion end interrupt request generation timing .............................................................. 147 11-12. av dd pin treatment ............................................................................................................................ 147 12-1. block diagram of 10-bit a/d converter ............................................................................................. 150 12-2. format of a/d converter mode register 0 ........................................................................................ 152 12-3. format of analog input channel specification register 0 ................................................................ 153 12-4. basic operation of 10-bit a/d converter ........................................................................................... 155 12-5. relationships between analog input voltage and a/d conversion result ...................................... 156 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 19 list of figures (3/4) figure no. title page 12-6. software-started a/d conversion ...................................................................................................... 157 12-7. how to reduce current consumption in standby mode .................................................................. 158 12-8. conversion result readout timing (when conversion result is undefined value) ...................... 159 12-9. conversion result readout timing (when conversion result is normal value) ........................... 159 12-10. analog input pin treatment ................................................................................................................ 160 12-11. a/d conversion end interrupt request generation timing .............................................................. 161 12-12. av dd pin treatment ............................................................................................................................ 161 13-1. serial interface 20 block diagram ..................................................................................................... 164 13-2. baud rate generator block diagram ................................................................................................ 165 13-3. serial operating mode register 20 format ....................................................................................... 167 13-4. asynchronous serial interface mode register 20 format ................................................................ 168 13-5. asynchronous serial interface status register 20 format ............................................................... 170 13-6. baud rate generator control register 20 format ........................................................................... 171 13-7. asynchronous serial interface transmit/receive data format ........................................................ 183 13-8. asynchronous serial interface transmission completion interrupt timing ..................................... 185 13-9. asynchronous serial interface reception completion interrupt timing ........................................... 186 13-10. receive error timing .......................................................................................................................... 187 13-11. 3-wire serial i/o mode timing ........................................................................................................... 192 14-1. block diagram of multiplier ................................................................................................................ 200 14-2. multiplier control register 0 format .................................................................................................. 201 14-3. multiplier operation timing ................................................................................................................. 202 15-1. basic configuration of interrupt function .......................................................................................... 205 15-2. interrupt request flag register format ............................................................................................ 207 15-3. interrupt mask flag register format ................................................................................................. 208 15-4. external interrupt mode register 0 format ....................................................................................... 209 15-5. program status word configuration .................................................................................................. 210 15-6. flowchart from non-maskable interrupt request generation to acknowledgement ....................... 212 15-7. timing of non-maskable interrupt request acknowledgement ........................................................ 212 15-8. acknowledging non-maskable interrupt request ............................................................................. 212 15-9. interrupt acknowledgement program algorithm ................................................................................ 214 15-10. interrupt request acknowledgement timing (example of mov a,r) ................................................ 215 15-11. interrupt request acknowledgement timing (when interrupt request flag is generated at the last clock during instruction execution) ....... 215 15-12. example of multiple interrupts ........................................................................................................... 216 16-1. oscillation stabilization time select register format ...................................................................... 220 16-2. releasing halt mode by interrupt .................................................................................................... 222 16-3. releasing halt mode by reset input ............................................................................................ 223 16-4. releasing stop mode by interrupt ................................................................................................... 225 16-5. releasing stop mode by reset input ........................................................................................... 226 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 20 list of figures (4/4) figure no. title page 17-1. block diagram of reset function ...................................................................................................... 227 17-2. reset timing by reset input ........................................................................................................... 228 17-3. reset timing by overflow in watchdog timer .................................................................................. 228 17-4. reset timing by reset input in stop mode .................................................................................. 228 18-1. communication mode selection format ............................................................................................ 232 18-2. flashpro iii connection in 3-wire serial i/o mode ........................................................................... 233 18-3. flashpro iii connection in uart mode ............................................................................................. 234 18-4. flashpro iii connection in pseudo 3-wire mode (when p0 is used) .............................................. 234 18-5. flashpro iii connection in 3-wire serial i/o mode ........................................................................... 235 18-6. flashpro iii connection in uart mode ............................................................................................. 235 18-7. flashpro iii connection in pseudo 3-wire mode (when p0 is used) .............................................. 236 a-1. development tool configuration ........................................................................................................ 252 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 21 list of tables (1/2) table no. title page 1-1. differences between standard quality grade products and (a) products ...................................... 30 2-1. differences between standard quality grade products and (a) products ...................................... 38 3-1. types of pin input/output circuits and recommended connection of unused pins ...................... 44 4-1. internal rom capacity ....................................................................................................................... 51 4-2. vector table ............................................................................................................................... .......... 51 4-3. special function register list ............................................................................................................ 61 5-1. port functions ............................................................................................................................... ...... 74 5-2. configuration of port ........................................................................................................................... 75 5-3. port mode register and output latch settings when using alternate functions .......................... 83 6-1. configuration of clock generator ...................................................................................................... 87 6-2. maximum time required for switching cpu clock .......................................................................... 93 7-1. configuration of clock generator ...................................................................................................... 95 7-2. maximum time required for switching cpu clock .......................................................................... 101 8-1. configuration of 16-bit timer 20 ........................................................................................................ 104 8-2. interval time of 16-bit timer 20 ......................................................................................................... 109 8-3. settings of capture edge ................................................................................................................... 112 9-1. interval time of 8-bit timer/event counter 80 .................................................................................. 115 9-2. square wave output range of 8-bit timer/event counter 80 ......................................................... 115 9-3. 8-bit timer/event counter 80 configuration ...................................................................................... 116 9-4. interval time of 8-bit timer/event counter 80 (at f x = 5.0-mhz operation) ................................... 120 9-5. interval time of 8-bit timer/event counter 80 (at f cc = 4.0-mhz operation) ................................. 120 9-6. square wave output range of 8-bit timer/event counter 80 (at f x = 5.0-mhz operation) .......... 123 9-7. square wave output range of 8-bit timer/event counter 80 (at f cc = 4.0-mhz operation) ........ 123 10-1. runaway detection time of watchdog timer ................................................................................... 129 10-2. interval time ............................................................................................................................... ......... 129 10-3. configuration of watchdog timer ....................................................................................................... 130 10-4. runaway detection time of watchdog timer ................................................................................... 133 10-5. interval time of interval timer ............................................................................................................ 134 11-1. configuration of 8-bit a/d converter ................................................................................................. 135 12-1. configuration of 10-bit a/d converter ............................................................................................... 149 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 22 list of tables (2/2) table no. title page 13-1. serial interface 20 configuration ....................................................................................................... 163 13-2. serial interface 20 operating mode settings .................................................................................... 169 13-3. example of relationships between system clock and baud rate .................................................. 172 13-4. relationship between asck20 pin input frequency and baud rate (when brgc20 is set to 80h) .......................................................................................................... 173 13-5. example of relationship between system clock and baud rate .................................................... 181 13-6. relationship between asck20 pin input frequency and baud rate (when brgc20 is set to 80h) ................................................................................ 182 13-7. receive error causes ......................................................................................................................... 187 15-1. interrupt source list ........................................................................................................................... 204 15-2. flags corresponding to interrupt request signal ............................................................................. 206 15-3. time from generation of maskable interrupt request to processing .............................................. 213 16-1. halt mode operating status ............................................................................................................ 221 16-2. operation after release of halt mode ............................................................................................. 223 16-3. stop mode operating status ............................................................................................................ 224 16-4. operation after release of stop mode ............................................................................................ 226 17-1. hardware status after reset .............................................................................................................. 229 18-1. differences between flash memory and mask rom versions ........................................................ 231 18-2. communication mode ......................................................................................................................... 232 18-3. functions of flash memory programming ......................................................................................... 233 18-4. example of settings for pg-fp3 ........................................................................................................ 237 19-1. selection of mask option for pins ...................................................................................................... 239 20-1. operand identifiers and description methods ................................................................................... 241 .com .com .com .com 4 .com u datasheet
23 users manual u14643ej1v0um00 chapter 1 general ( m pd789104a, 789114a subseries) 1.1 features rom and ram capacities item program memory data memory part number (internal high-speed ram) m pd789101a, 789111a rom 2 kbytes 256 bytes m pd789102a, 789112a 4 kbytes m pd789104a, 789114a 8 kbytes m pd78F9116A flash 16 kbytes memory system clock: crystal/ceramic oscillation two minimum instruction execution times selectable: high speed (0.4 m s) and low speed (1.6 m s) (system clock: 5.0 mhz) 20 i/o ports serial interface: 1 channel 3-wire serial i/o mode/uart mode selectable 8-bit resolution a/d converter: 4 channels ( m pd789104a subseries) 10-bit resolution a/d converter: 4 channels ( m pd789114a subseries) 3 timers ? 16-bit timer: 1 channel ? 8-bit timer/event counter: 1 channel ? watchdog timer: 1 channel multiplier: 8 bits 8 bits = 16 bits vectored interrupt source: 10 supply voltage: v dd = 1.8 to 5.5 v operating ambient temperature: t a = C40 to +85 c 1.2 applications vacuum cleaners, washing machines, refrigerators, battery chargers, etc. .com .com .com .com 4 .com u datasheet
24 chapter 1 general ( m pd789104a, 789114a subseries) users manual u14643ej1v0um00 1.3 ordering information part number package internal rom m pd789101amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789102amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789104amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789111amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789112amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789114amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd78F9116Amc-5a4 30-pin plastic ssop (7.62 mm (300) ) flash memory m pd789101amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789102amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789104amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789111amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789112amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789114amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom remark indicates rom code suffix. 1.4 quality grade part number package quality grade m pd789101amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd789102amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd789104amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd789111amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd789112amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd789114amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd78F9116Amc-5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd789101amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) special m pd789102amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) special m pd789104amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) special m pd789111amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) special m pd789112amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) special m pd789114amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) special remark indicates rom code suffix. please refer to quality grades on nec semiconductor devices (document no. c11531e) published by nec corporation to know the specification of quality grade on the devices and its recommended applications. .com .com .com .com 4 .com u datasheet
25 chapter 1 general ( m pd789104a, 789114a subseries) users manual u14643ej1v0um00 1.5 pin configuration (top view) ? 30-pin plastic ssop (7.62 mm (300) ) m pd789101amc- -5a4 m pd789102amc- -5a4 m pd789104amc- -5a4 m pd789111amc- -5a4 m pd789112amc- -5a4 m pd789114amc- -5a4 m pd78F9116Amc-5a4 m pd789101amc(a)- -5a4 m pd789102amc(a)- -5a4 m pd789104amc(a)- -5a4 m pd789111amc(a)- -5a4 m pd789112amc(a)- -5a4 m pd789114amc(a)- -5a4 cautions 1. connect the ic0 (internally connected) pin directly to the v ss pin. 2. connect the av dd pin to the v dd pin. 3. connect the av ss pin to the v ss pin. remark pin connection in parentheses is intended for the m pd78F9116A. p23/intp0/cpt20/ss20 p24/intp1/to80/to20 p25/intp2/ti80 av dd p60/ani0 p61/ani1 p62/ani2 p63/ani3 av ss p50 ic0 p51 p52 p53 p00 28 27 26 30 29 25 24 23 22 21 20 19 18 16 p22/si20/r x d20 p21/so20/t x d20 p20/sck20/asck20 p11 p10 v dd v ss x1 x2 ic0 (v pp ) ic0 reset p03 p02 p01 1 2 3 4 5 6 7 8 9 10 11 12 13 17 14 15 ani0 to ani3: analog input asck20: asynchronous serial input av dd : analog power supply av ss : analog ground cpt20: capture trigger input ic0: internally connected intp0 to intp2: interrupt from peripherals p00 to p03: port 0 p10, p11: port 1 p20 to p25: port 2 p50 to p53: port 5 p60 to p63: port 6 reset: reset rxd20: receive data sck20: serial clock si20: serial input so20: serial output ss20: chip select input ti80: timer input to20, to80: timer output txd20: transmit data v dd : power supply v pp : programming power supply v ss : ground x1, x2: crystal 1, 2 .com .com .com .com 4 .com u datasheet
26 chapter 1 general ( m pd789104a, 789114a subseries) users manual u14643ej1v0um00 1.6 78k/0s series lineup the products in the 78k/0s series are listed below. the names enclosed in boxes are subseries names. 78k/0s series small, general-purpose small, general-purpose + a/d for inverter control for driving lcd for assp 44/48 pins 44/48 pins 44 pins 44 pins 42/44 pins 28 pins 44 pins 30 pins 30 pins 30 pins 30 pins 30 pins 30 pins 44 pins products under mass production products under development y subseries supports smb. pd789014 80 pins 80 pins 64 pins 64 pins 64 pins 64 pins 64 pins 64 pins 44 pins 44 pins 20 pins 20 pins m pd789026 m pd789046 pd789026 with subsystem clock added pd789014 with timer reinforced and rom and ram expanded uart. low-voltage (1.8-v) operation rc oscillation model of pd789197ay pd789177 with internal eeprom tm pd789167 with improved a/d pd789104a with improved timer pd789146 with improved a/d pd789104a with eeprom added pd789124a with improved a/d rc oscillation model of pd789104a pd789104a with improved a/d pd789026 with a/d and multiplier added pd789407a with improved a/d pd789456 with improved i/o pd789446 with improved a/d pd789426 with improved display output pd789426 with improved a/d pd789306 with a/d added rc oscillation model of pd789306 basic subseries for driving lcd for pc keyboard. internal usb function for key pad. internal poc rc oscillation model of pd789860 for keyless entry. internal poc and key return circuit internal inverter control circuit and uart m pd789104a m pd789114a m pd789842 m pd789124a m pd789134a m pd789146 m pd789156 m pd789167 m pd789177 m pd789306 m pd789316 m pd789426 m pd789436 m pd789860 m pd789861 m pd789840 m pd789800 m pd789446 m pd789456 m pd789167y m pd789177y m m m m m m m m m m m m m m m m m m m m pd789197ay m m m pd789407a m pd789417a m pd789217ay 88 pins segment: 40 pins, common: 16 pins pd789830 m 144 pins segment/common output: 96 pins pd789835 m for driving dot lcd 52 pins 52 pins for remote controller. internal lcd controller/driver pd789327 m pd789467 m pd789327 with a/d added m .com .com .com .com 4 .com u datasheet
27 chapter 1 general ( m pd789104a, 789114a subseries) users manual u14643ej1v0um00 the major differences between subseries are shown below. timer rom capacity 8-bit 16-bit watch wdt 8-bit a/d 10-bit a/d serial interface i/o v dd min value remark m pd789046 16 k 1 ch m pd789026 4 k-16 k 1 ch 1 ch 34 pins small, general- purpose m pd789014 2 k-4 k 2 ch - - 1 ch -- 1 ch (uart:1 ch) 22 pins 1.8 v - m pd789177 - 8 ch m pd789167 16 k-24 k 3 ch 1 ch 8 ch - 31 pins - m pd789156 - 4 ch m pd789146 8 k-16 k 4 ch - internal eeprom m pd789134a 4 ch m pd789124a 4 ch - rc oscillation version m pd789114a - 4 ch small, general- purpose + a/d m pd789104a 2 k-8 k 1 ch 1 ch - 1 ch 4 ch - 1 ch (uart: 1 ch) 20 pins 1.8 v - for inverter control m pd789842 8 k-16 k 3 ch note 1 ch 1 ch 8 ch - 1 ch (uart: 1 ch) 30 pins 4.0 v - m pd789417a 7 ch m pd789407a 12 k-24 k 3 ch 7 ch - 43 pins m pd789456 - 6 ch m pd789446 6 ch - 30 pins m pd789436 - 6 ch m pd789426 12 k-16 k 6 ch 1 ch (uart: 1 ch) 40 pins - m pd789316 rc oscillation version for lcd driving m pd789306 8 k to 16k 2 ch 1 ch 1 ch 1 ch - - 2 ch (uart: 1 ch) 23 pins 1.8 v - m pd789835 24 k-60 k 6 ch - 2 ch 1 ch 27 pins 1.8 v for dot lcd driving m pd789830 24 k 1 ch 1 ch 1 ch 1 ch - - 1 ch (uart: 1 ch) 30 pins 2.7 v - m pd789467 1 ch - 18 pins m pd789327 4 k-24 k 2 ch - 1 ch 1 ch - 1 ch 21 pins 1.8 v internal lcd m pd789800 - 2 ch (usb: 1 ch) 31 pins 4.0 v m pd789840 8 k 1 ch 4 ch 1 ch 29 pins 2.8 v - m pd789861 rc oscillation version, internal eeprom assp m pd789860 4 k 2 ch - - 1 ch - - - 14 pins 1.8 v internal eeprom note 10-bit timer: 1 channel function subseries name .com .com .com .com 4 .com u datasheet
28 chapter 1 general ( m pd789104a, 789114a subseries) users manual u14643ej1v0um00 1.7 block diagram remarks 1. the size of the internal rom varies depending on the product. 2. items in parentheses apply to the m pd78F9116A. 78k/0s cpu core rom (flash memory) ram v dd v ss ic0 (v pp ) ti80/intp2/p25 8-bit timer/ event counter 80 to80/to20 /intp1/p24 p00 to p03 port0 p10, p11 port1 p20 to p25 port2 p50 to p53 port5 p60 to p63 port6 system control to20/to80 /intp1/p24 cpt20/intp0 /ss20/p23 16-bit timer 20 watchdog timer serial interface 20 sck20/asck20 /p20 si20/rxd20/p22 so20/txd20/p21 ss20/intp0 /cpt20/p23 a/d converter ani0/p60 to ani3/p63 av dd av ss reset x1 x2 interrupt control intp0/cpt20 /p23/ss20 intp1/to80 /to20/p24 intp2/ti80/p25 .com .com .com .com 4 .com u datasheet
29 chapter 1 general ( m pd789104a, 789114a subseries) users manual u14643ej1v0um00 1.8 outline of functions item m pd789101a m pd789102a m pd789104a m pd78F9116A m pd789111a m pd789112a m pd789114a maks rom mask rom flash memory internal memory rom 2 kbytes 4 kbytes 8 kbytes 16 kbytes high-speed ram 256 bytes system clock crystal/ceramic oscillation minimum instruction execution time 0.4/1.6 m s (@5.0-mhz operation with system clock) general registers 8 bits 8 registers instruction set ? 16-bit operations ? bit manipulations (such as set, reset, and test) multiplier 8 bits 8 bits = 16 bits i/o ports total: 20 ? cmos input: 4 ? cmos i/o: 12 ? n-ch open-drain (12-v withstand voltage): 4 a/d converter 8-bit resolution 4 channels ( m pd789104a subseries) 10-bit resolution 4 channels ( m pd789114a subseries) serial interface 3-wire serial i/o mode/uart mode selectable: 1 channel timer 16-bit timer: 1 channel 8-bit timer/event counter: 1 channel watchdog timer: 1 channel timer outputs one output vectored interrupt maskable internal: 6, external: 3 non-maskable internal: 1 power supply voltage v dd = 1.8 to 5.5 v operating ambient temperature t a = C40 to +85 c packages 30-pin plastic ssop (7.62 mm (300) ) an outline of the timers is shown below. 16-bit timer 20 8-bit timer/event counter 80 watchdog timer operating interval timer 1 channel 1 channel note mode external event timer 1 channel function timer output 1 output 1 output pwm output 1 output square wave output 1 output capture 1 input interrupt source 1 1 1 note since the watchdog timer provides the watchdog timer function and interval timer function, select the one out of two functions. .com .com .com .com 4 .com u datasheet
30 chapter 1 general ( m pd789104a, 789114a subseries) users manual u14643ej1v0um00 1.9 differences between standard quality grade products and (a) products table 1-1 shows the differences between the standard quality grade products ( m pd789101a, 789102a, 789104a, 789111a, 789112a, 789114a) and (a) products ( m pd789101a(a), 789102a(a), 789104a(a), 789111a(a), 789112a(a), 789114a(a)). table 1-1. differences between standard quality grade products and (a) products part number standard quality grade products (a) products item quality grade standard special electrical specifications refer to separate data sheets .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 31 chapter 2 general ( m pd789124a, 789134a subseries) 2.1 features rom and ram capacities item program memory data memory part number (internal high-speed ram) m pd789121a, 789131a rom 2 kbytes 256 bytes m pd789122a, 789132a 4 kbytes m pd789124a, 789134a 8 kbytes m pd78f9136a flash 16 kbytes memory system clock: rc oscillation two minimum instruction execution times selectable: high speed (0.5 m s) and low speed (2.0 m s) (system clock: 4.0 mhz) 20 i/o ports serial interface: 1 channel 3-wire serial i/o mode/uart mode selectable 8-bit resolution a/d converter: 4 channels ( m pd789124a subseries) 10-bit resolution a/d converter: 4 channels ( m pd789134a subseries) 3 timers ? 16-bit timer: 1 channel ? 8-bit timer/event counter: 1 channel ? watchdog timer: 1 channel multiplier: 8 bits 8 bits = 16 bits vectored interrupt source: 10 supply voltage: v dd = 1.8 to 5.5 v operating ambient temperature: t a = C40 to +85 c 2.2 applications vacuum cleaners, washing machines, refrigerators, battery chargers, etc. .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 32 chapter 2 general ( m pd789124a, 789134a subseries) 2.3 ordering information part number package internal rom m pd789121amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789122amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789124amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789131amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789132amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789134amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd78f9136amc-5a4 30-pin plastic ssop (7.62 mm (300) ) flash memory m pd789121amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789122amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789124amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789131amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789132amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom m pd789134amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) mask rom remark indicates rom code suffix. 2.4 quality grade part number package quality grade m pd789121amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd789122amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd789124amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd789131amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd789132amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd789134amc- -5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd78f9136amc-5a4 30-pin plastic ssop (7.62 mm (300) ) standard m pd789121amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) special m pd789122amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) special m pd789124amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) special m pd789131amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) special m pd789132amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) special m pd789134amc(a)- -5a4 30-pin plastic ssop (7.62 mm (300) ) special remark indicates rom code suffix. please refer to quality grades on nec semiconductor devices (document no. c11531e) published by nec corporation to know the specification of quality grade on the devices and its recommended applications. .com .com .com .com 4 .com u datasheet
chapter 2 general ( m pd789124a, 789134a subseries) users manual u14643ej1v0um00 33 2.5 pin configuration (top view) ? 30-pin plastic ssop (7.62 mm (300) ) m pd789121amc- -5a4 m pd789122amc- -5a4 m pd789124amc- -5a4 m pd789131amc- -5a4 m pd789132amc- -5a4 m pd789134amc- -5a4 m pd78f9136amc-5a4 m pd789121amc(a)- -5a4 m pd789122amc(a)- -5a4 m pd789124amc(a)- -5a4 m pd789131amc(a)- -5a4 m pd789132amc(a)- -5a4 m pd789134amc(a)- -5a4 cautions 1. connect the ic0 (internally connected) pin directly to the v ss pin. 2. connect the av dd pin to the v dd pin. 3. connect the av ss pin to the v ss pin. remark pin connection in parentheses is intended for the m pd78f9136a. p23/intp0/cpt20/ss20 p24/intp1/to80/to20 p25/intp2/ti80 av dd p60/ani0 p61/ani1 p62/ani2 p63/ani3 av ss p50 ic0 p51 p52 p53 p00 28 27 26 30 29 25 24 23 22 21 20 19 18 16 p22/si20/r x d20 p21/so20/t x d20 p20/sck20/asck20 p11 p10 v dd v ss cl1 cl2 ic0 (v pp ) ic0 reset p03 p02 p01 1 2 3 4 5 6 7 8 9 10 11 12 13 17 14 15 ani0 to ani3: analog input asck20: asynchronous serial input av dd : analog power supply av ss : analog ground cl1, cl2: rc oscillator cpt20: capture trigger input ic0: internally connected intp0 to intp2: interrupt from peripherals p00 to p03: port 0 p10, p11: port 1 p20 to p25: port 2 p50 to p53: port 5 p60 to p63: port 6 reset: reset rxd20: receive data sck20: serial clock si20: serial input so20: serial output ss20: chip select input ti80: timer input to20, to80: timer output txd20: transmit data v dd : power supply v pp : programming power supply v ss : ground .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 34 chapter 2 general ( m pd789124a, 789134a subseries) 2.6 78k/0s series lineup the products in the 78k/0s series are listed below. the names enclosed in boxes are subseries names. 78k/0s series small, general-purpose small, general-purpose + a/d for inverter control for driving lcd for assp 44/48 pins 44/48 pins 44 pins 44 pins 42/44 pins 28 pins 44 pins 30 pins 30 pins 30 pins 30 pins 30 pins 30 pins 44 pins products under mass production products under development y subseries supports smb. pd789014 80 pins 80 pins 64 pins 64 pins 64 pins 64 pins 64 pins 64 pins 44 pins 44 pins 20 pins 20 pins m pd789026 m pd789046 pd789026 with subsystem clock added pd789014 with timer reinforced and rom and ram expanded uart. low-voltage (1.8-v) operation rc oscillation model of pd789197ay pd789177 with internal eeprom tm pd789167 with improved a/d pd789104a with improved timer pd789146 with improved a/d pd789104a with eeprom added pd789124a with improved a/d rc oscillation model of pd789104a pd789104a with improved a/d pd789026 with a/d and multiplier added pd789407a with improved a/d pd789456 with improved i/o pd789446 with improved a/d pd789426 with improved display output pd789426 with improved a/d pd789306 with a/d added rc oscillation model of pd789306 basic subseries for driving lcd for pc keyboard. internal usb function for key pad. internal poc rc oscillation model of pd789860 for keyless entry. internal poc and key return circuit internal inverter control circuit and uart m pd789104a m pd789114a m pd789842 m pd789124a m pd789134a m pd789146 m pd789156 m pd789167 m pd789177 m pd789306 m pd789316 m pd789426 m pd789436 m pd789860 m pd789861 m pd789840 m pd789800 m pd789446 m pd789456 m pd789167y m pd789177y m m m m m m m m m m m m m m m m m m m m pd789197ay m m m pd789407a m pd789417a m pd789217ay 88 pins segment: 40 pins, common: 16 pins pd789830 m 144 pins segment/common output: 96 pins pd789835 m for driving dot lcd 52 pins 52 pins for remote controller. internal lcd controller/driver pd789327 m pd789467 m pd789327 with a/d added m .com .com .com .com 4 .com u datasheet
chapter 2 general ( m pd789124a, 789134a subseries) users manual u14643ej1v0um00 35 the major differences between subseries are shown below. timer rom capacity 8-bit 16-bit watch wdt 8-bit a/d 10-bit a/d serial interface i/o v dd min value remark m pd789046 16 k 1 ch m pd789026 4 k-16 k 1 ch 1 ch 34 pins small, general- purpose m pd789014 2 k-4 k 2 ch - - 1 ch -- 1 ch (uart:1 ch) 22 pins 1.8 v - m pd789177 - 8 ch m pd789167 16 k-24 k 3 ch 1 ch 8 ch - 31 pins - m pd789156 - 4 ch m pd789146 8 k-16 k 4 ch - internal eeprom m pd789134a 4 ch m pd789124a 4 ch - rc oscillation version m pd789114a - 4 ch small, general- purpose + a/d m pd789104a 2 k-8 k 1 ch 1 ch - 1 ch 4 ch - 1 ch (uart: 1 ch) 20 pins 1.8 v - for inverter control m pd789842 8 k-16 k 3 ch note 1 ch 1 ch 8 ch - 1 ch (uart: 1 ch) 30 pins 4.0 v - m pd789417a 7 ch m pd789407a 12 k-24 k 3 ch 7 ch - 43 pins m pd789456 - 6 ch m pd789446 6 ch - 30 pins m pd789436 - 6 ch m pd789426 12 k-16 k 6 ch 1 ch (uart: 1 ch) 40 pins - m pd789316 rc oscillation version for lcd driving m pd789306 8 k to 16k 2 ch 1 ch 1 ch 1 ch - - 2 ch (uart: 1 ch) 23 pins 1.8 v - m pd789835 24 k-60 k 6 ch - 2 ch 1 ch 27 pins 1.8 v for dot lcd driving m pd789830 24 k 1 ch 1 ch 1 ch 1 ch - - 1 ch (uart: 1 ch) 30 pins 2.7 v - m pd789467 1 ch - 18 pins m pd789327 4 k-24 k 2 ch - 1 ch 1 ch - 1 ch 21 pins 1.8 v internal lcd m pd789800 - 2 ch (usb: 1 ch) 31 pins 4.0 v m pd789840 8 k 1 ch 4 ch 1 ch 29 pins 2.8 v - m pd789861 rc oscillation version, internal eeprom assp m pd789860 4 k 2 ch - - 1 ch - - - 14 pins 1.8 v internal eeprom note 10-bit timer: 1 channel function subseries name .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 36 chapter 2 general ( m pd789124a, 789134a subseries) 2.7 block diagram remarks 1. the size of the internal rom varies depending on the product. 2. items in parentheses apply to the m pd78f9136a. 78k/0s cpu core rom (flash memory) ram ti80/intp2/p25 8-bit timer/ event counter 80 to80/to20 /intp1/p24 p00 to p03 port0 p10, p11 port1 p20 to p25 port2 p50 to p53 port5 p60 to p63 port6 system control to20/to80 /intp1/p24 cpt20/intp0 /ss20/p23 watchdog timer serial interface 20 sck20/asck20 /p20 si20/rxd20/p22 so20/txd20/p21 ss20/intp0 /cpt20/p23 a/d converter ani0/p60 to ani3/p63 av dd av ss reset cl1 cl2 interrupt control intp0/cpt20 /p23/ss20 intp1/to80 /to20/p24 intp2/ti80/p25 v dd v ss ic0 (v pp ) 16-bit timer 20 .com .com .com .com 4 .com u datasheet
chapter 2 general ( m pd789124a, 789134a subseries) users manual u14643ej1v0um00 37 2.8 outline of functions item m pd789121a m pd789122a m pd789124a m pd78f9136a m pd789131a m pd789132a m pd789134a internal memory rom mask rom flash memory 2 kbytes 4 kbytes 8 kbytes 16 kbytes high-speed ram 256 bytes system clock crystal/ceramic oscillation minimum instruction execution time 0.5/2.0 m s (@4.0-mhz operation with system clock) general registers 8 bits 8 registers instruction set ? 16-bit operations ? bit manipulations (such as set, reset, and test) multiplier 8 bits 8 bits = 16 bits i/o ports total: 20 ? cmos input: 4 ? cmos i/o: 12 ? n-ch open-drain (12-v withstand voltage ): 4 a/d converter 8-bit resolution 4 channels ( m pd789124a subseries) 10-bit resolution 4 channels ( m pd789134a subseries) serial interface 3-wire serial i/o mode/uart mode selectable: 1 channel timer 16-bit timer: 1 channel 8-bit timer/event counter: 1 channel watchdog timer: 1 channel timer outputs one output vectored interrupt maskable internal: 6, external: 3 non-maskable internal: 1 power supply voltage v dd = 1.8 to 5.5 v operating ambient temperature t a = C40 to +85 c packages 30-pin plastic ssop (7.62 mm (300) ) an outline of the timers is shown below. 16-bit timer 20 8-bit timer/event counter 80 watchdog timer operating interval timer 1 channel 1 channel note mode external event timer 1 channel function timer output 1 output 1 output pwm output 1 output square wave output 1 output capture 1 input interrupt source 1 1 1 note since the watchdog timer provides the watchdog timer function and interval timer function, select the one out of two functions. .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 38 chapter 2 general ( m pd789124a, 789134a subseries) 2.9 differences between standard quality grade products and (a) products table 2-1 shows the differences between the standard quality grade products ( m pd789121a, 789122a, 789124a, 789131a, 789132a, 789134a) and (a) products ( m pd789121a(a), 789122a(a), 789124a(a), 789131a(a), 789132a(a), 789134a(a)). table 2-1. differences between standard quality grade products and (a) products part number standard quality grade products (a) products item quality grade standard special electrical specifications refer to separate data sheets .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 39 chapter 3 pin functions 3.1 pin function list (1) port pins pin name input/output function after reset alternate function p00 to p03 input/output port 0 input 4-bit input/output port input/output can be specified in 1-bit units when used as an input port, an on-chip pull-up resistor can be specified by means of pull-up resistor option register 0 (pu0). p10, p11 input/output port 1 input 2-bit input/output port input/output can be specified in 1-bit units when used as an input port, an on-chip pull-up resistor can be specified by means of pull-up resistor option register 0 (pu0). p20 input/output port 2 input sck20/asck20 p21 6-bit input/output port so20/txd20 p22 input/output can be specified in 1-bit units si20/rxd20 p23 an on-chip pull-up resistor can be specified by means intp0/cpt20/ss20 p24 of pull-up resistor option register b2 (pub2) intp1/to80/to20 p25 intp2/ti80 p50 to p53 input/output port 5 input 4-bit n-channel open-drain input/output port input/output can be specified in 1-bit units for a mask rom version, an on-chip pull-up resistor can be specified by the mask option. p60 to p63 input port 6 input ani0 to ani3 4-bit input port .com .com .com .com 4 .com u datasheet
chapter 3 pin functions users manual u14643ej1v0um00 40 (2) non-port pins pin name input/output function after reset alternate function intp0 input external interrupt input for which the valid edge (rising input p23/cpt20/ss20 intp1 edge, falling edge, or both rising and falling edges) p24/to80/to20 intp2 can be specified. p25/ti80 si20 input serial data input to serial interface input p22/rxd20 so20 output serial data output from serial interface input p21/txd20 sck20 input/output serial clock input/output for serial interface input p20/asck20 asck20 input serial clock input to asynchronous serial interface input p20/sck20 ss20 input chip select input to serial interface input p23/cpt20/intp0 rxd20 input serial data input to asynchronous serial interface input p22/si20 txd20 output serial data output from asynchronous serial interface input p21/so20 ti80 input external count clock input to 8-bit timer (tm80) input p25/intp2 to80 output 8-bit timer (tm80) output input p24/intp1/to20 to20 output 16-bit timer (tm20) output input p24/intp1/to80 cpt20 input capture edge input input p23/intp0/ss20 ani0 to ani3 input a/d converter analog input input p60 to p63 av ss a/d converter ground potential av dd a/d converter analog power supply x1 input connecting crystal resonator for system clock x2 oscillation ( m pd789104a, 789114a subseries) cl1 input connecting resistor (r) and capacitor (c) for system cl2 clock oscillation ( m pd789124a and 789134a subseries) reset input system reset input input v dd positive power supply v ss ground potential ic0 internally connected. directly connect to the v ss pin. v pp sets flash memory programming mode. applies high voltage when a program is written or verified. connect directly to v ss in normal operation mode. .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 41 chapter 3 pin functions 3.2 description of pin functions 3.2.1 p00 to p03 (port 0) these pins constitute a 4-bit i/o port and can be set in input or output port mode in 1-bit units by using port mode register 0 (pm0). when these pins are used as an input port, use of an on-chip pull-up resistor can be specified by means of pull-up resistor option register 0 (pu0). 3.2.2 p10, p11 (port 1) these pins constitute a 2-bit i/o port and can be set in input or output port mode in 1-bit units by using port mode register 1 (pm1). when these pins are used as an input port, use of an on-chip pull-up resistor can be specified by means of pull-up resistor option register 0 (pu0). 3.2.3 p20 to p25 (port 2) these pins constitute a 6-bit i/o port. in addition, they function as timer input/outputs, external interrupt inputs, and serial interface data and clock input/outputs. port 2 can be specified in the following operation modes in 1-bit units. (1) port mode in this mode, p20 to p25 function as a 6-bit i/o port. port 2 can be specified as input or output mode in 1- bit units by using port mode register 2 (pm2). use of an on-chip pull-up resistor can be specified in 1-bit units by using pull-up resistor option register b2 (pub2), regardless of the setting of port mode register 2 (pm2). (2) control mode in this mode, p20 to p25 function as the timer input/output, the external interrupt input, and the clock input/ output of the serial interface and the data input/output. (a) ti80 this is the external clock input pin for 8-bit timer/event counter 80. (b) to20, to80 to20 is the output pin of the 16-bit timer. to80 is the output pin of the 8-bit timer. (c) cpt20 this is the input pin of the capture edge. (d) intp0 to intp2 these are external interrupt input pins for which the valid edge (rising edge, falling edge, and both rising and falling edges) can be specified. (e) si20, so20 these are the serial data i/o pins of the serial interface. (f) sck20 these are the serial clock i/o pins of the serial interface. (g) ss20 this is the chip select input pin of the serial interface. .com .com .com .com 4 .com u datasheet
chapter 3 pin functions users manual u14643ej1v0um00 42 (h) rxd20, txd20 these are the serial data i/o pins of the asynchronous serial interface. (i) asck20 this is the serial clock input pin of the asynchronous serial interface. caution when using these pins as serial interface pins, the input/output mode and output latch must be set according to the functions to be used. for the details of the setting, refer to table 13-2 serial interface 20 operating mode settings. 3.2.4 p50 to p53 (port 5) this is a 4-bit n-ch open-drain i/o port. port 5 can be specified in input or output mode in 1-bit units by using port mode register 5 (tm5). for a mask rom version, use of an on-chip pull-up resistor can be specified by the mask option. 3.2.5 p60 to p63 (port 6) this is a 4-bit input-only port. in addition to general-purpose input ports, these pins function as the a/d converter input pins. (1) port mode in the port mode, port 6 functions as a 4-bit input-only port. (2) control mode in the control mode, the pins of port 6 can be used as a/d converter analog inputs (ani0 to ani3). 3.2.6 reset this pin inputs an active-low system reset signal. 3.2.7 x1, x2 ( m pd789104a, 789114a subseries) these pins are used to connect a crystal resonator for system clock oscillation. to supply an external clock, input the clock to x1 and input the inverted signal to x2. 3.2.8 cl1, cl2 ( m pd789124a, 789134a subseries) resistor (r) and capacitor (c) connect pins for system clock oscillation. 3.2.9 av dd analog power supply pin of the a/d converter. always use the same potential as that of the v dd pin even when the a/d converter is not used. 3.2.10 av ss this is a ground potential pin of the a/d converter. always use the same potential as that of the v ss pin even when the a/d converter is not used. 3.2.11 v dd positive power supply pin 3.2.12 v ss ground pin .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 43 chapter 3 pin functions 3.2.13 v pp ( m pd78F9116A, 78f9136a only) a high voltage should be applied to this pin when the flash memory programming mode is set and when the program is written or verified. directly connect this pin to v ss in the normal operation mode. 3.2.14 ic0 (pin no.20) (mask rom version only) the ic0 (internally connected) pin (no. 20) (refer to 1.5 pin configuration (top view), 2.5 pin configuration (top view) ) is used to set the m pd789104a/114a/124a/134a subseries in the test mode before shipment. in the normal operation mode, connect this pin directly to the v ss pin with as short a wiring length as possible. if a potential difference is generated between the ic0 pin and v ss pin due to a long wiring length between the ic0 pin and v ss pin or external noise superimposed on the ic0 pin, the user program may not run correctly. connect the ic0 pin directly to the v ss pin. 3.2.15 ic0 (pins no.10 and no.21) the ic0 pins (no.10 and no.21) (refer to 1.5 pin configuration (top view) , 2.5 pin configuration (top view) are internally connected. connect the ic0 pins directly to v ss . v ss ic0 (pin no.20) keep short .com .com .com .com 4 .com u datasheet
chapter 3 pin functions users manual u14643ej1v0um00 44 3.3 pin input/output circuits and recommended connection of unused pins the input/output circuit type for each pin and the recommended connection of pins are shown in table 3-1. for the input/output circuit configuration of each type, refer to figure 3-1 . table 3-1. types of pin input/output circuits and recommended connection of unused pins pin name input/output circuit type input/output recommended connection of unused pins p00 to p03 5-a input/output input: independently connect these pins to v dd or p10, p11 v ss via a resistor. p20/sck20/asck20 8-a output: leave open p21/so20/txd20 p22/si20/rxd20 p23/intp0/cpt20/ss20 input: independently connect these pins to v ss via p24/intp1/to80/to20 a resistor. p25/intp2/ti80 output: leave open p50 to p53 13-w input: independently connect these pins to v dd via a (mask rom version) resistor. p50 to p53 13-v output: leave open ( m pd78F9116A, 78f9136a) p60/ani0 to p63/ani3 9-c input connect to v dd or v ss . av dd connect to v dd . av ss connect to v ss . reset 2 input ic0 connect directly to v ss . .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 45 chapter 3 pin functions figure 3-1. pin input/output circuits schmitt-triggered input with hysteresis characteristics type 2 in type 5-a pull-up enable data output disable input enable v dd p-ch v dd p-ch in/out n-ch type 13-v v ss v ss type 8-a pull-up enable data output disable v dd p-ch v dd p-ch in/out n-ch v ss type 9-c in comparator + v ref (threshold voltage) av ss p-ch n-ch input enable output data output disable in/out v dd n-ch input enable pull-up resistor (mask option) type 13-w v ss output data output disable in/out n-ch middle-voltage input buffer middle-voltage input buffer input enable .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 46 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 47 chapter 4 cpu architecture 4.1 memory space the m pd789104a/114a/124a/134a subseries can access 64 kbytes of memory space. figures 4-1 through 4- 4 show the memory maps. figure 4-1. memory map ( m pd789101a, 789111a, 789121a, 789131a) ffffh ff00h feffh fe00h fdffh 0800h 07ffh 0000h 07ffh 0000h 0080h 007fh 0040h 003fh 0016h 0015h data memory space program memory space special function registers 256 8 bits internal high-speed ram 256 8 bits reserved internal rom 2,048 8 bits program area callt table area program area vector table area .com .com .com .com 4 .com u datasheet
48 chapter 4 cpu architecture users manual u14643ej1v0um00 figure 4-2. memory map ( m pd789102a, 789112a, 789122a, 789132a) ffffh ff00h feffh fe00h fdffh 1000h 0fffh 0000h 0fffh 0000h 0080h 007fh 0040h 003fh 0016h 0015h data memory space program memory space special function registers 256 8 bits internal high-speed ram 256 8 bits reserved internal rom 4,096 8 bits program area callt table area program area vector table area .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 49 chapter 4 cpu architecture figure 4-3. memory map ( m pd789104a, 789114a, 789124a, 789134a) ffffh ff00h feffh fe00h fdffh 2000h 1fffh 0000h 1fffh 0000h 0080h 007fh 0040h 003fh 0016h 0015h data memory space program memory space special function registers 256 8 bits internal high-speed ram 256 8 bits reserved internal rom 8,192 8 bits program area callt table area program area vector table area .com .com .com .com 4 .com u datasheet
50 chapter 4 cpu architecture users manual u14643ej1v0um00 figure 4-4. memory map ( m pd78F9116A, 78f9136a) ffffh ff00h feffh fe00h fdffh 4000h 3fffh 0000h 3fffh 0000h 0080h 007fh 0040h 003fh 0016h 0015h data memory space program memory space special function registers 256 8 bits internal high-speed ram 256 8 bits reserved flash memory 16,384 8 bits program area callt table area program area vector table area .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 51 chapter 4 cpu architecture 4.1.1 internal program memory space the internal program memory space stores programs and table data. this space is usually addressed by the program counter (pc). the m pd789104a/114a/124a/134a subseries provides the following internal roms (or flash memory) containing the following capacities. table 4-1. internal rom capacity part number internal rom structure capacity m pd789101a, 789111a, 789121a, 789131a mask rom 2,048 8 bits m pd789102a, 789112a, 789122a, 789132a 4,096 8 bits m pd789104a, 789114a, 789124a, 789134a 8,192 8 bits m pd78F9116A, 78f9136a flash memory 16,384 8 bits the following areas are allocated to the internal program memory space: (1) vector table area a 22-byte area of addresses 0000h to 0015h is reserved as a vector table area. this area stores program start addresses to be used when branching by the reset input or an interrupt request generation. of a 16- bit program address, the lower 8 bits are stored in an even address, and the higher 8 bits are stored in an odd address. table 4-2. vector table vector table address interrupt request vector table address interrupt request 0000h reset input 000ch intsr20/intcsi20 0004h intwdt 000eh intst20 0006h intp0 0010h inttm80 0008h intp1 0012h inttm20 000ah intp2 0014h intad0 (2) callt instruction table area in a 64-byte area of addresses 0040h to 007fh, the subroutine entry address of a 1-byte call instruction (callt) can be stored. .com .com .com .com 4 .com u datasheet
52 chapter 4 cpu architecture users manual u14643ej1v0um00 4.1.2 internal data memory (internal high-speed ram) space the m pd789104a/114a/124a/134a subseries provides a 256-byte internal high-speed ram. the internal high-speed ram can also be used as a stack memory. 4.1.3 special function register (sfr) area special function registers (sfrs) of on-chip peripheral hardware are allocated to the area of ff00h to ffffh (refer to table 4-3 ). 4.1.4 data memory addressing the m pd789104a/114a/124a/134a subseries provides a variety of addressing modes which take account of memory manipulability, etc. especially at addresses corresponding to data memory area (fe00h to feffh), particular addressing modes are possible to meet the functions of the special function registers (sfrs) and general registers. figures 4-5 through 4-8 show the data memory addressing modes. figure 4-5. data memory addressing ( m pd789101a, 789111a, 789121a, 789131a) ffffh 0800h 07ffh 0000h ff00h feffh ff20h ff1fh fe20h fe1fh fe00h fdffh special function registers (sfrs) 256 8 bits internal high-speed ram 256 8 bits reserved internal rom 2,048 8 bits sfr addressing short direct addressing direct addressing register indirect addressing based addressing .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 53 chapter 4 cpu architecture figure 4-6. data memory addressing ( m pd789102a, 789112a, 789122a, 789132a) ffffh 1000h 0fffh 0000h ff00h feffh ff20h ff1fh fe20h fe1fh fe00h fdffh special function registers (sfrs) 256 8 bits internal high-speed ram 256 8 bits reserved internal rom 4,096 8 bits sfr addressing short direct addressing direct addressing register indirect addressing based addressing .com .com .com .com 4 .com u datasheet
54 chapter 4 cpu architecture users manual u14643ej1v0um00 figure 4-7. data memory addressing ( m pd789104a, 789114a, 789124a, 789134a) ffffh 2000h 1fffh 0000h fe00h fdffh ff00h feffh ff20h ff1fh fe20h fe1fh special function registers (sfrs) 256 8 bits internal high-speed ram 256 8 bits reserved internal rom 8,192 8 bits sfr addressing short direct addressing direct addressing register indirect addressing based addressing .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 55 chapter 4 cpu architecture figure 4-8. data memory addressing ( m pd78F9116A, 78f9136a) ffffh 4000h 3fffh 0000h fe00h fdffh ff00h feffh ff20h ff1fh fe20h fe1fh special function registers (sfrs) 256 8 bits internal high-speed ram 256 8 bits reserved flash memory 16,384 8 bits sfr addressing short direct addressing direct addressing register indirect addressing based addressing .com .com .com .com 4 .com u datasheet
56 chapter 4 cpu architecture users manual u14643ej1v0um00 4.2 processor registers the m pd789104a/114a/124a/134a subseries provides the following on-chip processor registers: 4.2.1 control registers the control registers contain special functions to control the program sequence statuses and stack memory. the program counter, program status word, and stack pointer are control registers. (1) program counter (pc) the program counter is a 16-bit register which holds the address information of the next program to be executed. in normal operation, the pc is automatically incremented according to the number of bytes of the instruction to be fetched. when a branch instruction is executed, immediate data or register contents is set. reset input sets the reset vector table values at addresses 0000h and 0001h to the program counter. figure 4-9. program counter configuration (2) program status word (psw) the program status word is an 8-bit register consisting of various flags to be set/reset by instruction execution. program status word contents are automatically stacked upon interrupt request generation or push psw instruction execution and are automatically restored upon execution of the reti and pop psw instructions. reset input sets the psw to 02h. figure 4-10. program status word configuration 0 15 pc14 pc15 pc pc13 pc12 pc11 pc10 pc9 pc8 pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 70 ie z 0 ac 0 0 1 cy psw .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 57 chapter 4 cpu architecture (a) interrupt enable flag (ie) this flag controls interrupt request acknowledge operations of cpu. when ie = 0, the ie is set to interrupt disabled (di) status. all interrupt requests except non-maskable interrupt are disabled. when ie = 1, the ie is set to interrupt enabled (ei) status and interrupt request acknowledgement is controlled with an interrupt mask flag for various interrupt sources. this flag is reset (0) upon di instruction execution or interrupt acknowledgment and is set (1) upon ei instruction execution. (b) zero flag (z) when the operation result is zero, this flag is set (1). it is reset (0) in all other cases. (c) auxiliary carry flag (ac) if the operation result has a carry from bit 3 or a borrow at bit 3, this flag is set to (1). it is reset (0) in all other cases. (d) carry flag (cy) this flag stores overflow and underflow upon add/subtract instruction execution. it stores the shift-out value upon rotate instruction execution and functions as a bit accumulator during bit manipulation instruction execution. .com .com .com .com 4 .com u datasheet
58 chapter 4 cpu architecture users manual u14643ej1v0um00 (3) stack pointer (sp) this is a 16-bit register to hold the start address of the memory stack area. only the internal high-speed ram area can be set as the stack area. figure 4-11. stack pointer configuration the sp is decremented ahead of write (save) to the stack memory and is incremented after read (restore) from the stack memory. each stack operation saves/restores data as shown in figures 4-12 and 4-13. caution since reset input makes the sp contents undefined, be sure to initialize the sp before instruction execution. figure 4-12. data to be saved to stack memory figure 4-13. data to be restored from stack memory interrupt psw pc15 to pc8 pc15 to pc8 pc7 to pc0 register pair lower sp sp _ 2 sp _ 2 call, callt instructions push rp instruction sp _ 1 sp sp sp _ 2 sp _ 2 sp _ 1 sp pc7 to pc0 sp _ 3 sp _ 2 sp _ 1 sp sp sp _ 3 register pair higher reti instruction psw pc15 to pc8 pc15 to pc8 pc7 to pc0 register pair lower ret instruction pop rp instruction sp pc7 to pc0 register pair higher sp + 1 sp sp + 2 sp sp + 1 sp sp + 2 sp sp + 1 sp + 2 sp sp + 3 0 15 sp14 sp15 sp sp13 sp12 sp11 sp10 sp9 sp8 sp7 sp6 sp5 sp4 sp3 sp2 sp1 sp0 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 59 chapter 4 cpu architecture 4.2.2 general registers the general registers consist of eight 8-bit registers (x, a, c, b, e, d, l, and h). each register can be used as an 8-bit register, and in addition, two 8-bit registers in pairs can be used as a 16- bit register (ax, bc, de, and hl). they can be described in terms of functional names (x, a, c, b, e, d, l, h, ax, bc, de, and hl) and absolute names (r0 to r7 and rp0 to rp3). figure 4-14. general register configuration (a) absolute names (b) functional names r0 15 0 7 0 16-bit processing 8-bit processing rp3 rp2 rp1 rp0 r1 r2 r3 r4 r5 r6 r7 x 15 0 7 0 16-bit processing 8-bit processing hl de bc ax a c b e d l h .com .com .com .com 4 .com u datasheet
60 chapter 4 cpu architecture users manual u14643ej1v0um00 4.2.3 special function registers (sfrs) unlike general registers, special function registers have their own functions and are allocated to the 256-byte area ff00h to ffffh. special function registers can be manipulated, like general registers, with operation, transfer, and bit manipulation instructions. the bit units in which one register can be manipulated (1, 8, and 16) differ depending on the special function register type. each bit unit for manipulation can be specified as follows. ? 1-bit manipulation a symbol reserved by assembler is described as the operand (sfr.bit) of a 1-bit manipulation instruction. this manipulation can also be specified with an address. ? 8-bit manipulation a symbol reserved by assembler is described as the operand (sfr) of an 8-bit manipulation instruction. this manipulation can also be specified with an address. ? 16-bit manipulation a symbol reserved by assembler is described as the operand of a 16-bit manipulation instruction. when specifying an address, describe an even address. table 4-3 lists the special function registers. the meanings of the symbols in this table are as follows: ? symbol indicates the addresses of the implemented special function registers. the symbols shown in this column are the reserved words of the assembler, and have already been defined in the header file called sfrbit.h of the c compiler. therefore, these symbols can be used as instruction operands if assembler or integrated debugger is used. ? r/w indicates whether the special function register in question can be read or written. r/w: read/write r: read only w: write only ? bit units for manipulation indicates the bit units (1, 8, and 16) in which the special function register in question can be manipulated. ? after reset indicates the status of the special function register when the reset signal is input. .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 61 chapter 4 cpu architecture table 4-3. special function register list (1/2) address special function register (sfr) name symbol r/w bit units for manipulation after reset 1 bit 8 bits 16 bits ff00h port 0 p0 r/w ?? 00h ff01h port 1 p1 ?? ff02h port 2 p2 ?? ff05h port 5 p5 ?? ff06h port 6 p6 r ?? ff10h 16-bit multiplication result storage register 0 mul0l mul0 ? note 1 ? note 2 undefined ff11h mul0h ff14h a/d conversion result register note 3 adcr0 ?? note 2 ff15h ff16h 16-bit compare register 20 cr20l cr20 w ? note 1 ? note 2 ffffh ff17h cr20h ff18h 16-bit timer counter 20 tm20l tm20 r ? note 1 ? note 2 0000h ff19h tm20h ff1ah 16-bit capture register 20 tcp20l tcp20 ? note 1 ? note 2 undefined ff1bh tcp20h ff20h port mode register 0 pm0 r/w ?? ffh ff21h port mode register 1 pm1 ?? ff22h port mode register 2 pm2 ?? ff25h port mode register 5 pm5 ?? ff32h pull-up resistor option register b2 pub2 ?? 00h ff42h time clock select register 2 tcl2 ? ff48h 16-bit timer mode control register 20 tmc20 ?? ff50h 8-bit compare register 80 cr80 w ? ff51h 8-bit timer counter 80 tm80 r ? undefined ff53h 8-bit timer mode control register 80 tmc80 r/w ?? 00h notes 1. although these registers are usually accessed in 16-bit units, they can also be accessed in 8-bit units. access these registers in 8-bit units by means of direct addressing. 2. these registers can be accessed in 16-bit units only by means of short direct addressing. 3. when this register is used as an 8-bit a/d converter ( m pd789104a and 789124a subseries), it can be accessed only in 8-bit units. at this time, the register address is ff15h. when this register is used as a 10-bit a/d converter ( m pd789114a and 789134a subseries), it can be accessed only in 16-bit units. when using the m pd78F9116A as the flash memory version of the m pd789101a, 789102a, or 789104a, or when using the m pd78f9136a as the flash memory version of the m pd789121a, 789122a, or 789124a, this register can be accessed in 8-bit units. however, only the object file assembled with the m pd789101a, 789102a, or 789104a, or object file assembled with the m pd789121a, 789122a, or 789124a can be used. .com .com .com .com 4 .com u datasheet
62 chapter 4 cpu architecture users manual u14643ej1v0um00 table 4-3. special function register list (2/2) address special function register (sfr) name symbol r/w bit units for manipulation after reset 1 bit 8 bits 16 bits ff70h asynchronous serial interface mode register 20 asim20 r/w ?? 00h ff71h asynchronous serial interface status register 20 asis20 r ?? ff72h serial operating mode register 20 csim20 r/w ?? ff73h baud rate generator control register 20 brgc20 ? ff74h transmit shift register 20 txs20 sio20 w ? ffh receive buffer register 20 rxb20 r ? undefined ff80h a/d converter mode register 0 adm0 r/w ?? 00h ff84h analog input channel specification register 0 ads0 ?? ffd0h multiplication data register a0 mra0 w ?? undefined ffd1h multiplication data register b0 mrb0 ?? ffd2h multiplier control register 0 mulc0 r/w ?? 00h ffe0h interrupt request flag register 0 if0 ?? ffe1h interrupt request flag register 1 if1 ?? ffe4h interrupt mask flag register 0 mk0 ?? ffh ffe5h interrupt mask flag register 1 mk1 ?? ffech external interrupt mode register 0 intm0 ? 00h fff7h pull-up resistor option register 0 pu0 ?? fff9h watchdog timer mode register wdtm ?? fffah oscillation stabilization time select register note osts ? 04h fffbh processor clock control register pcc ?? 02h note m pd789104a, 789114a subseries only .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 63 chapter 4 cpu architecture 4.3 instruction address addressing an instruction address is determined by the program counter (pc) contents. the pc contents are normally incremented (+1 for each byte) automatically according to the number of bytes of an instruction to be fetched each time another instruction is executed. when a branch instruction is executed, the branch destination information is set to the pc and branched by the following addressing (for details of each instruction, refer to 78k/0s series users manual instruction (u11047e) ). 4.3.1 relative addressing [function] the value obtained by adding 8-bit immediate data (displacement value: jdisp8) of an instruction code to the start address of the following instruction is transferred to the program counter (pc) and branched. the displacement value is treated as signed twos complement data (C128 to +127) and bit 7 becomes a sign bit. in other words, the range of branch in relative addressing is between C128 and +127 of the start address of the following instruction. this function is carried out when the br $addr16 instruction or a conditional branch instruction is executed. [illustration] 15 0 pc 15 0 s 15 0 pc + 876 a jdisp8 when s = 0, a indicates all bits ?? ... pc is the start address of the next instruction of a br instruction. when s = 1, a indicates all bits ?? .com .com .com .com 4 .com u datasheet
64 chapter 4 cpu architecture users manual u14643ej1v0um00 4.3.2 immediate addressing [function] immediate data in the instruction word is transferred to the program counter (pc) and branched. this function is carried out when the call !addr16 and br !addr16 instructions are executed. call !addr16 and br !addr16 instructions can branch to all the memory spaces. [illustration] in case of call !addr16, br !addr16 instruction 15 0 pc 87 70 call or br low addr. high addr. .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 65 chapter 4 cpu architecture 4.3.3 table indirect addressing [function] table contents (branch destination address) of the particular location to be addressed by the lower 5-bit immediate data of an instruction code from bit 1 to bit 5 are transferred to the program counter (pc) and branched. table indirect addressing is carried out when the callt [addr5] instruction is executed. this instruction can refer to the address stored in the memory table 40h to 7fh and branch to all the memory spaces. [illustration] 4.3.4 register addressing [function] register pair (ax) contents to be specified with an instruction word are transferred to the program counter (pc) and branched. this function is carried out when the br ax instruction is executed. [illustration] 15 1 15 0 pc 70 low addr. high addr. memory (table) effective address + 1 effective address 01 00000000 87 87 65 0 0 1 11 765 10 ta 4? instruction code 70 rp 07 ax 15 0 pc 87 .com .com .com .com 4 .com u datasheet
66 chapter 4 cpu architecture users manual u14643ej1v0um00 4.4 operand address addressing the following various methods are available to specify the register and memory (addressing) which undergo manipulation during instruction execution. 4.4.1 direct addressing [function] the memory indicated by immediate data in an instruction word is directly addressed. [operand format] identifier description addr16 label or 16-bit immediate data [description example] mov a, !fe00h; when setting !addr16 to fe00h instruction code 0 0 1 0 1 0 0 1 op code 0000000000h 11111110feh [illustration] 70 op code addr16 (low) addr16 (high) memory .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 67 chapter 4 cpu architecture 4.4.2 short direct addressing [function] the memory to be manipulated in the fixed space is directly addressed with 8-bit data in an instruction word. the fixed space where this addressing is applied to is the 256-byte space fe20h to ff1fh. an internal high- speed ram and a special function register (sfr) are mapped at fe20h to feffh and ff00h to ff1fh, respectively. the sfr area (ff00h to ff1fh) where short direct addressing is applied is a part of all sfr areas. in this area, ports which are frequently accessed in a program and a compare register of the timer/event counter are mapped, and these sfrs can be manipulated with a small number of bytes and clocks. when 8-bit immediate data is at 20h to ffh, bit 8 of an effective address is set to 0. when it is at 00h to 1fh, bit 8 is set to 1. refer to [illustration] . [operand format] identifier description saddr label or fe20h to ff1fh immediate data saddrp label or fe20h to ff1fh immediate data (even address only) [description example] mov fe90h, #50h; when setting saddr to fe90h and the immediate data to 50h instruction code 1 1 1 1 0101 op code 10010000 90h (saddr-offset) 01010000 50h (immediate data) [illustration] 15 0 short direct memory effective address 1 111111 8 0 7 op code saddr-offset a when 8-bit immediate data is 20h to ffh, = 0. when 8-bit immediate data is 00h to 1fh, = 1. a a .com .com .com .com 4 .com u datasheet
68 chapter 4 cpu architecture users manual u14643ej1v0um00 4.4.3 special function register (sfr) addressing [function] memory-mapped special function registers (sfrs) are addressed with 8-bit immediate data in an instruction word. this addressing is applied to the 240-byte spaces ff00h to ffcfh and ffe0h to ffffh. however, sfrs mapped at ff00h to ff1fh can be accessed with short direct addressing. [operand format] identifier description sfr special function register name [description example] mov pm0, a; when selecting pm0 for sfr instruction code 11100111 00100000 [illustration] 15 0 sfr effective address 1 111111 87 0 7 op code sfr-offset 1 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 69 chapter 4 cpu architecture 4.4.4 register addressing [function] general registers are accessed as operands. the general register to be accessed is specified with the register specify code and functional name in the instruction code. register addressing is carried out when an instruction with the following operand format is executed. when an 8-bit register is specified, one of the eight registers is specified with 3 bits in the instruction code. [operand format] identifier description r x, a, c, b, e, d, l, h rp ax, bc, de, hl r and rp can be described with absolute names (r0 to r7 and rp0 to rp3) as well as function names (x, a, c, b, e, d, l, h, ax, bc, de, and hl). [description example] mov a, c; when selecting the c register for r instruction code 0 0 0 0 1010 00100101 register specify code incw de; when selecting the de register pair for rp instruction code 1 0 0 0 1000 register specify code .com .com .com .com 4 .com u datasheet
70 chapter 4 cpu architecture users manual u14643ej1v0um00 4.4.5 register indirect addressing [function] the memory is addressed with the contents of the register pair specified as an operand. the register pair to be accessed is specified with the register pair specify code in the instruction code. this addressing can be carried out for all the memory spaces. [operand format] identifier description [de], [hl] [description example] mov a, [de]; when selecting register pair [de] instruction code 00101011 [illustration] 15 0 8 d 7 e 0 7 7 0 a de the contents of addressed memory are transferred memory address specified by register pair de .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 71 chapter 4 cpu architecture 4.4.6 based addressing [function] 8-bit immediate data is added to the contents of the base register, that is, the hl register pair, and the sum is used to address the memory. addition is performed by expanding the offset data as a positive number to 16 bits. a carry from the 16th bit is ignored. this addressing can be carried out for all the memory spaces. [operand format] identifier description [hl+byte] [description example] mov a, [hl+10h]; when setting byte to 10h instruction code 00101101 00010000 4.4.7 stack addressing [function] the stack area is indirectly addressed with the stack pointer (sp) contents. this addressing method is automatically employed when the push, pop, subroutine call, and return instructions are executed or the register is saved/reset upon generation of an interrupt request. stack addressing enables to address the internal high-speed ram area only. [description example] in the case of push de instruction code 10101010 .com .com .com .com 4 .com u datasheet
72 users manual u14643ej1v0um00 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 73 chapter 5 port functions 5.1 functions of ports the m pd789104a/114a/124a/134a subseries provides the ports shown in figure 5-1, enabling various methods of control. numerous other functions are provided that can be used in addition to the digital i/o port function. for more information on these additional functions, refer to chapter 3 pin functions . figure 5-1. port types port 5 p50 p53 port 6 p60 p63 p00 p03 p10 port 0 port 1 p11 p20 p25 port 2 .com .com .com .com 4 .com u datasheet
chapter 5 port functions users manual u14643ej1v0um00 74 table 5-1. port functions pin name input/output function after reset alternate function p00 to p03 input/output port 0 input 4-bit i/o port input/output can be specified in 1-bit units when used as input port, an on-chip pull-up resistor can be specified by means of pull-up resistor option register 0 (pu0). p10, p11 input/output port 1 input 2-bit i/o port input/output can be specified in 1-bit units when used as input port, an on-chip pull-up resistor can be specified by means of pull-up resistor option register 0 (pu0). p20 input/output port 2 input asck20/sck20 p21 6-bit i/o port txd20/so20 p22 input/output can be specified in 1-bit units rxd20/si20 p23 an on-chip pull-up resistor can be specified by means intp0/cpt20/ss20 p24 of pull-up resistor option register b2 (pub2). intp1/to80/to20 p25 intp2/ti80 p50 to p53 input/output port 5 input 4-bit n-ch open-drain i/o port input/output can be specified in 1-bit units an on-chip pull-up resistor can be specified for mask rom versions by the mask option. p60 to 63 input port 6 input ani0 to ani3 4-bit input-only port .com .com .com .com 4 .com u datasheet
chapter 5 port functions users manual u14643ej1v0um00 75 5.2 port configuration a port consists of the following hardware. table 5-2. configuration of port parameter configuration control register port mode register (pmm: m = 0 to 2, 5) pull-up resistor option register 0 (pu0) pull-up option register b2 (pub2) port total: 20 (input: 7, input/output: 16) pull-up resistor ? mask rom versions total: 16 (software control: 12, mask option specification: 4) ? flash memory versions total: 12 (software control only) 5.2.1 port 0 this is a 4-bit i/o port with output latches. port 0 can be specified as input or output mode in 1-bit units by using port mode register 0 (pm0). when pins p00 to p03 are used as input port pins, on-chip pull-up resistors can be connected in 4-bit units by using pull-up resistor option register 0 (pu0). reset input sets port 0 to input mode. figure 5-2 shows the block diagram of port 0. figure 5-2. block diagram of p00 to p03 pu0: pull-up resistor option register 0 pm: port mode register rd: port 0 read signal wr: port 0 write signal internal bus wr pu0 rd wr port wr pm pu00 output latch (p00 to p03) pm00 to pm03 v dd p-ch p00 to p03 selector .com .com .com .com 4 .com u datasheet
chapter 5 port functions users manual u14643ej1v0um00 76 5.2.2 port 1 this is a 2-bit i/o port with output latches. port 1 can be specified as input or output mode in 1-bit units by using port mode register 1 (pm1). when pins p10 and p11 are used as input port pins, on-chip pull-up resistors can be connected in 2-bit units by using pull-up resistor option register 0 (pu0). reset input sets port 1 to input mode. figure 5-3 shows the block diagram of port 1. figure 5-3. block diagram of p10 and p11 pu0: pull-up resistor option register 0 pm: port mode register rd: port 1 read signal wr: port 1 write signal internal bus wr pu0 rd wr port wr pm pu01 output latch (p10, p11) pm10, pm11 v dd p-ch p10, p11 selector .com .com .com .com 4 .com u datasheet
chapter 5 port functions users manual u14643ej1v0um00 77 5.2.3 port 2 this is a 6-bit i/o port with output latches. port 2 can be specified as input or output mode in 1-bit units by using port mode register 2 (pm2). use of on-chip pull-up resistors can be specified for pins p20 to p25 in 1-bit units by using pull-up resistor option register b2 (pub2). the port is also used as a serial interface i/o, clock i/o, timer i/o, and external i;derrupt input. reset input sets port 2 to input mode. figures 5-4 through 5-7 show block diagrams of port 2. caution when using the pins of port 2 as the serial interface, the i/o or output latch must be set according to the function to be used. for how to set the latches, see table 13-2 serial interface 20 operating mode settings. figure 5-4. block diagram of p20 pub2: pull-up resistor option register b2 pm: port mode register rd: port 2 read signal wr: port 2 write signal internal bus v dd p-ch p20/asck20/ sck20 wr pub2 rd wr port wr pm pub20 alternate function output latch (p20) pm20 alternate function selector .com .com .com .com 4 .com u datasheet
chapter 5 port functions users manual u14643ej1v0um00 78 internal bus v dd p-ch p21/txd20/ so20 wr pub2 rd wr port wr pm pub21 output latch (p21) pm21 alternate function selector serial output enable signal figure 5-5. block diagram of p21 pub2: pull-up resistor option register b2 pm: port mode register rd: port 2 read signal wr: port 2 write signal .com .com .com .com 4 .com u datasheet
chapter 5 port functions users manual u14643ej1v0um00 79 figure 5-6. block diagram of p22, p23, and p25 pub2: pull-up resistor option register b2 pm: port mode register rd: port 2 read signal wr: port 2 write signal internal bus v dd p-ch p22/rxd20/si20 p23/intp0/cpt20/ ss20 p25/intp2/ti80 wr pub2 rd wr port wr pm pub22, pub23, pub25 alternate function output latch (p22, p23, p25) pm22, pm23, pm25 selector .com .com .com .com 4 .com u datasheet
chapter 5 port functions users manual u14643ej1v0um00 80 figure 5-7. block diagram of p24 pub2: pull-up resistor option register b2 pm: port mode register rd: port 2 read signal wr: port 2 write signal wr pub2 selector rd pm24 pub24 alternate function alternate function p24/intp1/ to80/to20 p-ch wr port output latch (p24) wr pm internal bus alternate function v dd .com .com .com .com 4 .com u datasheet
chapter 5 port functions users manual u14643ej1v0um00 81 5.2.4 port 5 this is a 4-bit n-ch open-drain i/o port with output latches. port 5 can be specified as input or output mode in 1-bit units by using port mode register 5 (pm5). for a mask rom version, whether a pull-up resistor is to be incorporated can be specified by the mask option. reset input sets port 5 to input mode. figure 5-8 shows a block diagram of port 5. figure 5-8. block diagram of p50 to p53 pm: port mode register rd: port 5 read signal wr: port 5 write signal caution when using port 5 of m pd78F9116A and 78f9136a as an input port, be sure to observe the restrictions listed below. <1> when v dd = 1.8 to 5.5 v use within the range of t a = 25 to 85 c <2> when t a = e40 to +85 c use within the range of v dd = 2.7 to 5.5 v <3> when t a = e40 to +85 c and v dd = 1.8 to 5.5 v issue three consecutive read instructions when reading port 5. if the above restrictions are not observed, the input value may be read incorrectly. note, however, that these resrictions do not apply when port 5 pins are used as output pins, or when the product is other than m pd78F9116A or 78f9136a. internal bus selector rd pm50 to pm53 p50 to p53 n-ch wr port output latch (p50 to p53) wr pm v dd mask option resistor mask rom version only. for flash memory version, a pull-up resistor is not incorporated. .com .com .com .com 4 .com u datasheet
chapter 5 port functions users manual u14643ej1v0um00 82 5.2.5 port 6 this is a 4-bit input port. the port is also used as an analog input to the a/d converter. reset input sets port 6 to input mode. figure 5-9 shows a block diagram of port 6. figure 5-9. block diagram of p60 to p63 internal bus v ref rd a/d converter p60/ani0 to p63/ani3 + .com .com .com .com 4 .com u datasheet
chapter 5 port functions users manual u14643ej1v0um00 83 5.3 port function control registers the following three types of registers control the ports. ? port mode registers (pm0 to pm2, pm5) ? pull-up resistor option register 0 (pu0) ? pull-up resistor option register b2 (pub2) (1) port mode registers (pm0 to pm2, pm5) these registers are used to set port input/output in 1-bit units. port mode registers are independently set with a 1-bit or 8-bit memory manipulation instruction. reset input sets these registers to ffh. when port pins are used as alternate-function pins, set the port mode register and output latch according to table 5-3. caution as port 2 has an alternate function as external interrupt input, when the port function output mode is specified and the output level is changed, the interrupt request flag is set. when the output mode is used, therefore, the interrupt mask flag should be set to 1 beforehand. table 5-3. port mode register and output latch settings when using alternate functions pin name alternate function pm p name input/output p23 intp0 input 1 cpt20 input 1 p24 intp1 input 1 to80 output 0 0 to20 output 0 0 p25 intp2 input 1 ti80 input 1 caution when port 2 is used for serial interface pin, the i/o latch or output latch must be set according to its function. for the setting method, refer to table 13-2 serial interface 20 operating mode settings. remark : dont care pm : port mode register p : port output latch .com .com .com .com 4 .com u datasheet
chapter 5 port functions users manual u14643ej1v0um00 84 figure 5-10. port mode register format (2) pull-up resistor option register 0 (pu0) the pull-up resistor option register (pu0) sets whether to use on-chip pull-up resistors at each port or not. at a port where use of on-chip pull-up resistors has been specified by pu0, the pull-up resistors can be internally used only for the bits set in input mode. no on-chip pull-up resistors can be used for the bits set in output mode, in spite of setting pu0. on-chip pull-up resistors can also not be used when the pins are used as the alternate-function output pins. pu0 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears pu0 to 00h. figure 5-11. pull-up resistor option register 0 format (3) pull-up resistor option register b2 (pub2) this register specifies whether an on-chip pull-up resistor is connected to each pin of port 2. the pin so specified by pub2 is connected to on-chip pull-up resistor regardless of the setting of the port mode register. pub2 is set with a 1-bit or 8-bit manipulation instruction. reset input sets this register to 00h. figure 5-12. pull-up resistor option register b2 format pmmn 0 output mode (output buffer on) input mode (output buffer off) 1 1 1 1 1 1 1 1 1 1 1 pm25 1 1 1 pm24 1 pm03 1 pm23 pm53 pm02 1 pm22 pm52 pm01 pm11 pm21 pm51 pm00 pm10 pm20 pm50 pm0 pm1 pm2 pm5 7 symbol address after reset 6543210 r/w ff20h ff21h ff22h ff25h ffh ffh ffh ffh r/w r/w r/w r/w pmn pin input/output mode selection (m = 0 to 2, 5, n = 0 to 7) pu0m 0 1 000000 pu01 pu00 pu0 symbol address pm on-chip pull-up resistor selection (m = 0, 1) on-chip pull-up resistor not used on-chip pull-up resistor used after reset 7654 r/w fff7h 00h r/w 3 2 <1> <0> pub2n 0 1 00 pub25 pub24 pub23 pub22 pub21 pub20 pub2 symbol address p2n on-chip pull-up resistor selection (n = 0 to 5) on-chip pull-up resistor not used on-chip pull-up resistor used after reset 7 6 <5> <4> r/w ff32h 00h r/w <3> <2> <1> <0> .com .com .com .com 4 .com u datasheet
chapter 5 port functions users manual u14643ej1v0um00 85 5.4 operation of port functions the operation of a port differs depending on whether the port is set in input or output mode, as described below. 5.4.1 writing to i/o port (1) in output mode a value can be written to the output latch of a port by using a transfer instruction. the contents of the output latch can be output from the pins of the port. the data once written to the output latch is retained until new data is written to the output latch. (2) in input mode a value can be written to the output latch by using a transfer instruction. however, the status of the port pin is not changed because the output buffer is off. the data once written to the output latch is retained until new data is written to the output latch. caution a 1-bit memory manipulation instruction is executed to manipulate 1 bit of a port. however, this instruction accesses the port in 8-bit units. when this instruction is executed to manipulate a bit of an input/output port, therefore, the contents of the output latch of the pin that is set in the input mode and not subject to manipulation become undefined. 5.4.2 reading from i/o port (1) in output mode the contents of the output latch can be read by using a transfer instruction. the contents of the output latch are not changed. (2) in input mode the status of a pin can be read by using a transfer instruction. the contents of the output latch are not changed. caution when using port 5 of m pd78F9116A and 78f9136a as an input port, be sure to observe the restrictions listed below. <1> when v dd = 1.8 to 5.5 v use within the range of t a = 25 to 85 c <2> when t a = e40 to +85 c use within the range of v dd = 2.7 to 5.5 v <3> when t a = e40 to +85 c and v dd = 1.8 to 5.5 v issue three consecutive read instructions when reading port 5. if the above restrictions are not observed, the input value may be read incorrectly. note, however, that these resrictions do not apply when port 5 pins are used as output pins, or when the product is other than m pd78F9116A or 78f9136a. .com .com .com .com 4 .com u datasheet
chapter 5 port functions users manual u14643ej1v0um00 86 5.4.3 arithmetic operation of i/o port (1) in output mode an arithmetic operation can be performed with the contents of the output latch. the result of the operation is written to the output latch. the contents of the output latch are output from the port pins. the data once written to the output latch is retained until new data is written to the output latch. (2) in input mode the contents of the output latch become undefined. however, the status of the pin is not changed because the output buffer is off. caution a 1-bit memory manipulation instruction is executed to manipulate 1 bit of a port. however, this instruction accesses the port in 8-bit units. when this instruction is executed to manipulate a bit of an input/output port, therefore, the contents of the output latch of the pin that is set in the input mode and not subject to manipulation become undefined. .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 87 chapter 6 clock generator ( m pd789104a, 789114a subseries) 6.1 function of clock generator the clock generator generates the clock to be supplied to the cpu and peripheral hardware. the system clock oscillator is the following type. ? system clock (crystal/ceramic) oscillator this circuit oscillates at frequencies of 1.0 to 5.0 mhz. oscillation can be stopped by executing the stop instruction. 6.2 configuration of clock generator the clock generator consists of the following hardware. table 6-1. configuration of clock generator item configuration control register processor clock control register (pcc) oscillator crystal/ceramic oscillator figure 6-1. block diagram of clock generator f x prescaler system clock oscillator 2 2 f x selector pcc1 internal bus processor clock control register (pcc) prescaler standby control circuit wait control circuit cpu clock (f cpu ) clock to peripheral hardware stop x1 x2 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 88 chapter 6 clock generator ( m pd789104a, 789114a subseries) 6.3 register controlling clock generator the clock generator is controlled by the following register: ? processor clock control register (pcc) (1) processor clock control register (pcc) pcc sets the cpu clock selection and the ratio of division. pcc is set with a 1-bit or 8-bit memory manipulation instruction. reset input sets pcc to 02h. figure 6-2. processor clock control register format caution bit 0 and bits 2 to 7 must be set to 0. remarks 1. f x : system clock oscillation frequency 2. values in parentheses are when operating at f x = 5.0 mhz. 3. minimum instruction execution time: 2f cpu ? when f cpu = 0.2 m s: 0.4 m s ? when f cpu = 0.8 m s: 1.6 m s 000000 pcc1 0 pcc symbol address after reset r/w fffbh 02h r/w 76543210 pcc1 cpu clock (f cpu ) selection 0 1 f x f x /2 2 (0.2 s) (0.8 s) m m .com .com .com .com 4 .com u datasheet
chapter 6 clock generator ( m pd789104a, 789114a subseries) users manual u14643ej1v0um00 89 6.4 system clock oscillator 6.4.1 system clock oscillator the system clock oscillator is oscillated by the crystal or ceramic resonator (5.0 mhz typ.) connected across the x1 and x2 pins. an external clock can also be input to the system clock oscillator. in this case, input the clock signal to the x1 pin, and leave the x2 pin open. figure 6-3 shows the external circuit of the system clock oscillator. figure 6-3. external circuit of system clock oscillator (a) crystal or ceramic oscillation (b) external clock caution when using the system clock oscillator, wire as follows in the area enclosed by the broken lines in the above figures to avoid an adverse effect from wiring capacitance. ? keep the wiring length as short as possible. ? do not cross the wiring with the other signal lines. do not route the wiring near a signal line through which a high fluctuating current flows. ? always make the ground point of the oscillator capacitor the same potential as v ss . do not ground the capacitor to a ground pattern through which a high current flows. ? do not fetch signals from the oscillator. figure 6-4 shows incorrect examples of resonator connection. crystal or ceramic resonator v ss x2 external clock open x1 x2 x1 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 90 chapter 6 clock generator ( m pd789104a, 789114a subseries) figure 6-4. examples of incorrect resonator connection (1/2) (a) too long wiring (b) crossed signal line v ss x1 x2 v ss x1 x2 portn (n = 0 to 2, 5, 6) .com .com .com .com 4 .com u datasheet
chapter 6 clock generator ( m pd789104a, 789114a subseries) users manual u14643ej1v0um00 91 figure 6-4. examples of incorrect resonator connection (2/2) (c) wiring near high fluctuating current (d) current flowing through ground line of oscillator (potential at points a, b, and c fluctuates) (e) signal is fetched v ss x1 x2 high current v ss x1 ab c p mn v dd high current x2 v ss x1 x2 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 92 chapter 6 clock generator ( m pd789104a, 789114a subseries) 6.4.2 divider the divider divides the output of the system clock oscillator (f x ) to generate various clocks. 6.5 operation of clock generator the clock generator generates the following clocks and controls the operating modes of the cpu, such as the standby mode: ? system clock f x ? cpu clock f cpu ? clock to peripheral hardware the operation of the clock generator is determined by the processor clock control register (pcc), as follows: (a) the slow mode 2f cpu (1.6 m s: at 5.0-mhz operation) of the system clock is selected when the reset signal is generated (pcc = 02h). while a low level is input to the reset pin, oscillation of the system clock is stopped. (b) two types of cpu clocks f cpu (0.2 m s and 0.8 m s: at 5.0-mhz operation) can be selected by the pcc setting. (c) two standby modes, stop and halt, can be used. (d) the clock to the peripheral hardware is supplied by dividing the system clock. the other peripheral hardware is stopped when the system clock is stopped (except the external clock input operation). .com .com .com .com 4 .com u datasheet
chapter 6 clock generator ( m pd789104a, 789114a subseries) users manual u14643ej1v0um00 93 6.6 changing setting of cpu clock 6.6.1 time required for switching cpu clock the cpu clock can be selected by using bit 1 (pcc1) of the processor clock control register (pcc). actually, the specified clock is not selected immediately after the setting of pcc has been changed, and the old clock is used for the duration of several instructions after that (refer to table 6-2 ). table 6-2. maximum time required for switching cpu clock set value before switching set value after switching pcc1 pcc1 pcc1 01 0 4 clocks 1 2 clocks remark two clocks are the minimum instruction execution time of the cpu clock before switching. 6.6.2 switching cpu clock the following figure illustrates how the cpu clock switches. figure 6-5. switching cpu clock <1> the cpu is reset when the reset pin is made low on power application. the effect of resetting is released when the reset pin is later made high, and the system clock starts oscillating. at this time, the time during which oscillation stabilizes (2 15 /f x ) is automatically secured. after that, the cpu starts instruction execution at the low speed of the system clock (1.6 m s: at 5.0-mhz operation). <2> after the time during which the v dd voltage rises to the level at which the cpu can operate at the highest speed has elapsed, the processor clock control register (pcc) is rewritten so that the highest speed can be selected. v dd reset cpu clock slow operation fastest operation wait (6.55 ms: at 5.0-mhz operation) internal reset operation .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 94 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 95 chapter 7 clock generator ( m pd789124a, 789134a subseries) 7.1 function of clock generator the clock generator generates the clock to be supplied to the cpu and peripheral hardware. the system clock oscillator consists of the following type. ? system clock (rc) oscillator this circuit oscillates at frequencies of 2.0 to 4.0 mhz. oscillation can be stopped by executing the stop instruction. 7.2 configuration of clock generator the clock generator consists of the following hardware. table 7-1. configuration of clock generator item configuration control register processor clock control register (pcc) oscillator rc oscillator figure 7-1. block diagram of clock generator f cc prescaler system clock oscillator 2 2 f cc selector pcc1 internal bus processor clock control register (pcc) prescaler standby control circuit wait control circuit cpu clock (f cpu ) clock to peripheral hardware stop cl1 cl2 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 96 chapter 7 clock generator ( m pd789124a, 789134a subseries) 7.3 register controlling clock generator the clock generator is controlled by the following register: ? processor clock control register (pcc) (1) processor clock control register (pcc) pcc sets the cpu clock selection and the ratio of division. pcc is set with a 1-bit or 8-bit memory manipulation instruction. reset input sets the pcc to 02h. figure 7-2. processor clock control register format caution bit 0 and bits 2 to 7 must be set to 0. remarks 1. f cc : system clock oscillation frequency 2. values in parentheses are when operating at f x = 4.0 mhz. 3. minimum instruction execution time: 2f cpu ? when f cpu = 0.25 m s: 0.5 m s ? when f cpu = 1.0 m s: 2.0 m s 000000 pcc1 0 pcc symbol address after reset r/w fffbh 02h r/w 76543210 pcc1 cpu clock (f cpu ) selection 0 1 f cc f cc /2 2 (0.25 s) (1.0 s) m m .com .com .com .com 4 .com u datasheet
chapter 7 clock generator ( m pd789124a, 789134a subseries) users manual u14643ej1v0um00 97 7.4 system clock oscillator 7.4.1 system clock oscillator the system clock oscillator is oscillated by the resistor (r) and capacitor (c) (4.0 mhz typ.) connected across the cl1 and cl2 pins. an external clock can also be input to the system clock oscillator. in this case, input the clock signal to the cl1 pin, and leave the cl2 pin open. figure 7-3 shows the external circuit of the system clock oscillator. figure 7-3. external circuit of system clock oscillator (a) rc oscillation (b) external clock caution when using the system clock oscillator, wire as follows in the area enclosed by the broken lines in the above figures to avoid an adverse effect from wiring capacitance. ? keep the wiring length as short as possible. ? do not cross the wiring with the other signal lines. do not route the wiring near a signal line through which a high fluctuating current flows. ? always make the ground point of the oscillator capacitor the same potential as v ss . do not ground the capacitor to a ground pattern through which a high current flows. ? do not fetch signals from the oscillator. figure 7-4 shows incorrect examples of resonator connection. v ss cl1 r c cl2 external clock open cl1 cl2 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 98 chapter 7 clock generator ( m pd789124a, 789134a subseries) figure 7-4. examples of incorrect resonator connection (1/2) (a) too long wiring (b) crossed signal line v ss cl2 cl1 v ss cl2 portn (n = 0 to 2, 5, 6) cl1 .com .com .com .com 4 .com u datasheet
chapter 7 clock generator ( m pd789124a, 789134a subseries) users manual u14643ej1v0um00 99 figure 7-4. examples of incorrect resonator connection (2/2) (c) wiring near high fluctuating current (d) current flowing through ground line of oscillator (potential at points a and b fluctuates) (e) signal is fetched v ss cl2 cl1 high current v ss v dd cl2 cl1 portn (n = 0 to 2, 5, 6) ab high current v ss cl2 cl1 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 100 chapter 7 clock generator ( m pd789124a, 789134a subseries) 7.4.2 divider the divider divides the output of the system clock oscillator (f cc ) to generate various clocks. 7.5 operation of clock generator the clock generator generates the following clocks and controls the operating modes of the cpu, such as the standby mode: ? system clock f cc ? cpu clock f cpu ? clock to peripheral hardware the operation of the clock generator is determined by the processor clock control register (pcc), as follows: (a) the slow mode 2f cpu (2.0 m s: at 4.0-mhz operation) of the system clock is selected when the reset signal is generated (pcc = 02h). while a low level is input to the reset pin, oscillation of the system clock is stopped. (b) two types of cpu clocks f cpu (0.5 m s and 1.0 m s: at 4.0-mhz operation) can be selected by the pcc setting. (c) two standby modes, stop and halt, can be used. (d) the clock to the peripheral hardware is supplied by dividing the system clock. the other peripheral hardware is stopped when the system clock is stopped (except the external clock input operation). .com .com .com .com 4 .com u datasheet
chapter 7 clock generator ( m pd789124a, 789134a subseries) users manual u14643ej1v0um00 101 7.6 changing setting of cpu clock 7.6.1 time required for switching cpu clock the cpu clock can be selected by using bit 1 (pcc1) of the processor clock control register (pcc). actually, the specified clock is not selected immediately after the setting of pcc has been changed, and the old clock is used for the duration of several instructions after that (refer to table 7-2 ). table 7-2. maximum time required for switching cpu clock set value before switching set value after switching pcc1 pcc1 pcc1 01 0 4 clocks 1 2 clocks remark two clocks are the minimum instruction execution time of the cpu clock before switching. 7.6.2 switching cpu clock the following figure illustrates how the cpu clock switches. figure 7-5. switching cpu clock <1> the cpu is reset when the reset pin is made low on power application. the effect of resetting is released when the reset pin is later made high, and the system clock starts oscillating. at this time, the time during which oscillation stabilizes (2 7 /f cc ) is automatically secured. after that, the cpu starts instruction execution at the low speed of the system clock (2.0 m s: at 4.0-mhz operation). <2> after the time during which the v dd voltage rises to the level at which the cpu can operate at the highest speed has elapsed, the processor clock control register (pcc) is rewritten so that the highest speed can be selected. v dd reset cpu clock slow operation fastest operation wait (32 s: at 4.0-mhz operation) internal reset operation m .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 102 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 103 chapter 8 16-bit timer 20 the 16-bit timer counter references the free running counter and provides the functions such as timer interrupt and timer output. in addition, the count value can be captured by a trigger pin. 8.1 16-bit timer 20 functions 16-bit timer 20 has the following functions. ? timer interrupt ? timer output ? count value capture (1) timer interrupt an interrupt is generated when a count value and compare value matches. (2) timer output timer output control is possible when an count value and compare value matches. (3) count value capture a tm20 count value is latched in synchronization with the capture trigger and retained. .com .com .com .com 4 .com u datasheet
chapter 8 16-bit timer 20 users manual u14643ej1v0um00 104 8.2 16-bit timer 20 configuration 16-bit timer 20 consists of the following hardware. table 8-1. configuration of 16-bit timer 20 item configuration timer counter 16 bits 1 (tm20) register compare register: 16 bits 1 (cr20) capture register: 16 bits 1 (tcp20) timer output 1 (to20) control register 16-bit timer mode control register 20 (tmc20) port mode register 2 (pm2) figure 8-1. block diagram of 16-bit timer 20 remark f clk : f x or f cc cpt20/p23/ intp0/ss20 internal bus internal bus 16-bit timer mode control register 20 (tmc20) 16-bit timer mode control register 20 tof20 cpt201cpt200 toc20 tcl201tcl200 toe20 f clk /2 2 f clk /2 6 edge detection circuit 16-bit capture register 20 (tcp20) 16-bit counter read buffer 16-bit timer counter 20 (tm20) 16-bit compare register 20 (cr20) match selector ovf f/f tod20 to20/p24/ intp1/to80 inttm20 p24 output latch pm24 .com .com .com .com 4 .com u datasheet
chapter 8 16-bit timer 20 users manual u14643ej1v0um00 105 (1) 16-bit compare register 20 (cr20) this register compares the value set to cr20 with the count value of 16-bit timer counter 20 (tm20), and when they match, generates an interrupt request (inttm20). cr20 is set with a 16-bit memory manipulation instruction. the values 0000h to ffffh can be set. reset input sets this register to ffffh. cautions 1. although this register is manipulated with a 16-bit memory manipulation instruction, an 8-bit memory manipulation instruction can be used. when manipulated with an 8-bit memory manipulation instruction, the accessing method should be direct addressing. 2. when rewriting cr20 during count operation, set cr20 to interrupt disable from interrupt mask flag register 0 (mk10) beforehand. also, set the timer output data to inversion disable using 16-bit timer mode control register 20 (tmc20). when cr20 is rewritten in the interrupt-enabled state, an interrupt request may occur at the moment of rewrite. (2) 16-bit timer counter 20 (tm20) this is a 16-bit register that counts count pulses. tm20 is read with a 16-bit memory manipulation instruction. this register is free running during count clock input. reset input clears this register to 0000h and after which it resumes free running. cautions 1. the count value after releasing stop becomes undefined because the count operation is executed during the oscillation stabilization time. 2. although this register is manipulated with a 16-bit memory manipulation instruction, an 8-bit memory manipulation instruction can be used. when manipulated with an 8-bit memory manipulation instruction, the accessing method should be direct addressing. 3. when manipulated with an 8-bit memory manipulation instruction, readout should be performed in the order from lower byte to higher byte and must be in pairs. (3) 16-bit capture register 20 (tcp20) this is a 16-bit register that captures the contents of 16-bit timer counter 20 (tm20). tcp20 is set with a 16-bit memory manipulation instruction. reset input sets this register to undefined. caution although this register is manipulated with a 16-bit memory manipulation instruction, an 8- bit memory manipulation instruction can be used. when manipulated with an 8-bit memory manipulation instruction, the accessing method should be direct addressing. (4) 16-bit counter read buffer this buffer latches a counter value and retains the count value of 16-bit timer counter 20 (tm20). .com .com .com .com 4 .com u datasheet
chapter 8 16-bit timer 20 users manual u14643ej1v0um00 106 8.3 registers controlling 16-bit timer 20 the following two types of registers control 16-bit timer 20. ? 16-bit timer mode control register 20 (tmc20) ? port mode register 2 (pm2) (1) 16-bit timer mode control register 20 (tmc20) 16-bit timer mode control register 20 (tmc20) controls the setting of the counter clock, capture edge, etc. tmc20 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears tmc20 to 00h. .com .com .com .com 4 .com u datasheet
chapter 8 16-bit timer 20 users manual u14643ej1v0um00 107 figure 8-2. 16-bit timer mode control register 20 format note bit 7 is read-only. remark f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) cpt201 0 0 1 1 cpt200 0 1 0 1 capture operation disabled rising edge of cpt20 falling edge of cpt20 both edges of cpt20 tof20 0 1 set by overflow of 16-bit timer toc20 0 1 timer output data inverse control inverse disabled inverse enabled tod20 0 1 timer output data timer output of 0 timer output of 1 capture edge selection toe20 0 1 tcl201 0 0 other than above tcl200 0 1 f x /2 2 (1.25 mhz) f x /2 6 (78.1 khz) setting prohibited 16-bit timer 20 output control output disabled (port mode) output enabled 16-bit timer counter 20 count clock selection overflow flag set clear by reset and software 1 tod20 tof20 cpt201 cpt200 toc20 tcl201 tcl200 toe20 tmc20 r/w ff48h 00h r/w <6>54321 7 <0> symbol address after reset note at f x = 5.0 mhz at f cc = 4.0 mhz f cc /2 2 (1.0 mhz) f cc /2 6 (62.5 khz) .com .com .com .com 4 .com u datasheet
chapter 8 16-bit timer 20 users manual u14643ej1v0um00 108 (2) port mode register 2 (pm2) this register sets the input/output of port 2 in 1-bit units. to use the p24/to20/intp1/to80 pin for timer output, set the output latch of pm24 and p24 to 0. pm2 is set with a 1-bit or 8-bit memory manipulation instruction. reset input sets pm2 to ffh. figure 8-3. port mode register 2 format 11 pm25 pm24 pm23 pm22 pm21 pm20 pm2 r/w ff22h ffh r/w 654321 pm24 0 1 70 input mode (output buffer off) symbol address after reset p24 pin input/output mode selection output mode (output buffer on) .com .com .com .com 4 .com u datasheet
chapter 8 16-bit timer 20 users manual u14643ej1v0um00 109 8.4 16-bit timer 20 operation 8.4.1 operation as timer interrupt in the timer interrupt function, interrupts are repeatedly generated at the count value set to 16-bit compare register 20 (cr20) in advance based on the intervals of the value set in tcl201 and tcl200. to operate the 16-bit timer 20 as a timer interrupt, the following settings are required. ? set count values to cr20 ? set 16-bit timer mode control counter 20 (tmc20) as shown in figure 8-4. figure 8-4. settings of 16-bit timer mode control register 20 at timer interrupt operation caution if both the cpt201 and cpt200 flags are set to 0, the capture edge becomes setting prohibited. when the count value of 16-bit timer counter 20 (tm20) coincides with the value set to cr20, counting of tm20 continues and an interrupt request signal (inttm20) is generated. table 8-3 shows the interval time, and figure 8-5 shows the timing of the timer interrupt operation. caution when rewriting cr20 during count operation, be sure to follow the procedure below. <1> set cr20 to interrupt disable (by setting bit 7 of interrupt mask flag register 0 (mk0) to 1). <2> set inversion control of timer output data to disable (toc20 = 0) when cr20 is rewritten in the interrupt-enabled state, an interrupt request may occur at the moment of rewrite. table 8-2. interval time of 16-bit timer 20 tcl201 tcl200 count clock interval time at f x = 5.0 mhz at f cc = 4.0 mhz at f x = 5.0 mhz at f cc = 4.0 mhz 002 2 /f x (0.8 m s) 2 2 /f cc (1.0 m s) 2 18 /f x (52.4 ms) 2 18 /f cc (65.5 ms) 012 6 /f x (12.8 m s) 2 6 /f cc (16 m s) 2 22 /f x (838.9 ms) 2 22 /f cc (1,048 ms) other than above setting prohibited remark f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) 0/1 0/1 0/1 0/1 0 0/1 0/1 tod20 tof20 cpt201 cpt200 toc20 tcl201 tcl200 toe20 tmc20 setting of count clock (see table 8-2 ) .com .com .com .com 4 .com u datasheet
chapter 8 16-bit timer 20 users manual u14643ej1v0um00 110 figure 8-5. timing of timer interrupt operation remark n = 0000h to ffffh count clock tm20 count value cr20 inttm20 to20 tof20 0000h 0001h n ffffh 0000h 0001h n ffffh nn n nn interrupt accept interrupt accept overflow flag set t .com .com .com .com 4 .com u datasheet
chapter 8 16-bit timer 20 users manual u14643ej1v0um00 111 8.4.2 operation as timer output timer outputs are repeatedly generated at the count value set to 16-bit compare register 20 (cr20) in advance based on the intervals of the value set in tcl201 and tcl200. to operate the 16-bit timer 20 as a timer output, the following settings are required. ? set p24 to output mode (pm24 = 0) ? set p24 output latch to 0 ? set the count value to cr20 ? set 16-bit timer mode control register 20 (tmc20) as shown in figure 8-6 figure 8-6. settings of 16-bit timer mode control register 20 at timer output operation caution if both cpt201 flag and cpt200 flag are set to 0, the capture edge becomes operation prohibited. when the count value of the 16-bit timer counter 20 (tm20) matches the value set in cr20, the output status of the to20/p24/intp1/to80 pin is inverted. this enables timer output. at that time, tm20 count is continued and an interrupt request signal (inttm20) is generated. figure 8-7 shows the timing of timer output (see table 8-2 for the interval time of the 16-bit timer 20). figure 8-7. timer output timing note the to20 initial value becomes low level during output enable (toe20 = 1). remark n = 0000h to ffffh count clock tm20 count value cr20 inttm20 to20 note tof20 0000h 0001h n ffffh 0000h 0001h n ffffh nn n nn interrupt accept interrupt accept overflow flag set t 0/1 0/1 0/1 1 0 0/1 1 tod20 tof20 cpt201 cpt200 toc20 tcl201 tcl200 toe20 tmc20 setting of count clock (see table 8-2 ) inverse enable of timer output data to20 output enable .com .com .com .com 4 .com u datasheet
chapter 8 16-bit timer 20 users manual u14643ej1v0um00 112 8.4.3 capture operation the capture operation functions to capture and latch the count value of 16-bit timer counter 20 (tm20) in synchronization with a capture trigger. set as shown in figure 8-8 to allow 16-bit timer 20 to start the capture operation. figure 8-8. settings of 16-bit timer mode control register 20 at capture operation 16-bit capture register 20 (tcp20) starts the capture operation after the cpt20 capture trigger edge has been detected, and latches and retains the count value of 16-bit timer counter 20. tcp20 fetches the count value within 2 clocks and retains the count value until the next capture edge detection. table 8-3 and figure 8-9 show the setting contents of the capture edge and capture operation timing, respectively. table 8-3. settings of capture edge cpt201 cpt200 capture edge selection 0 0 capture operation prohibited 0 1 cpt20 pin rising edge 1 0 cpt20 pin falling edge 1 1 cpt20 pin both edges caution because tcp20 is rewritten when a capture trigger edge is detected during tcp20 read, disable the capture trigger detection during tcp20 read. figure 8-9. capture operation timing (both edges of cpt20 pin are specified) count clock tm20 count read buffer tcp20 cpt20 0000h 0000h 0001h 0001h undefined n n n m ?1 m m m capture start capture start capture edge detection capture edge detection 0/1 0/1 0/1 0/1 0 0/1 0/1 tod20 tof20 cpt201 cpt200 toc20 tcl201 tcl200 toe20 tmc20 count clock selection capture edge selection (see table 8-3 ) .com .com .com .com 4 .com u datasheet
chapter 8 16-bit timer 20 users manual u14643ej1v0um00 113 8.4.4 16-bit timer counter 20 readout the count value of 16-bit timer counter 20 (tm20) is read out by a 16-bit manipulation instruction. tm20 readout is performed through a counter read buffer. the counter read buffer latches the tm20 count value. buffer operation is then held pending at the cpu clock falling edge after the read signal of the tm20 lower byte rises and the count value is retained. the counter read buffer value at the retention state can be read out as the count value. cancellation of the pending state is performed at the cpu clock falling edge after the read signal of the tm20 higher byte falls. reset input clears tm20 to 0000h and restarts free running. figure 8-10 shows the timing of 16-bit timer counter 20 readout. cautions 1. the count value after releasing stop becomes undefined because the count operation is executed during oscillation stabilization time. 2. although tm20 is a dedicated 16-bit transfer instruction register, an 8-bit transfer instruction can be used. execute an 8-bit transfer instruction by direct addressing. 3. when using an 8-bit transfer instruction, execute in the order from lower byte to higher byte in pairs. if the only lower byte is read, the pending state of the counter read buffer is not canceled, and if the only higher byte is read, an undefined count value is read. figure 8-10. 16-bit timer counter 20 readout timing cpu clock count clock tm20 count read buffer tm20 read signal 0000h 0000h 0001h 0001h n n n + 1 read signal latch prohibited period .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 114 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 115 chapter 9 8-bit timer/event counter 80 the 8-bit timer/event counter can be used as an interval timer, external event counter, and for square wave output and pwm output of arbitrary frequency. 9.1 functions of 8-bit timer/event counter 80 8-bit timer/event counter 80 has the following functions: ? interval timer ? external event counter ? square wave output ? pwm output (1) 8-bit interval timer when the 8-bit timer/event counter is used as an interval timer, it generates an interrupt at an arbitrary time interval set in advance. table 9-1. interval time of 8-bit timer/event counter 80 minimum interval time maximum interval time resolution at f x = 5.0 mhz 1/f x (200 ns) 2 8 /f x (51.2 m s) 1/f x (200 ns) 2 3 /f x (1.6 m s) 2 11 /f x (409.6 m s) 2 3 /f x (1.6 m s) at f cc = 4.0 mhz 1/f cc (250 ns) 2 8 /f cc (64 m s) 1/f cc (250 ns) 2 3 /f cc (2.0 m s) 2 11 /f cc (512 m s) 2 3 /f cc (2.0 m s) remark f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) (2) external event counter the number of pulses of an externally input signal can be measured. (3) square wave output a square wave of arbitrary frequency can be output. table 9-2. square wave output range of 8-bit timer/event counter 80 minimum pulse width maximum pulse width resolution at f x = 5.0 mhz 1/f x (200 ns) 2 8 /f x (51.2 m s) 1/f x (200 ns) 2 3 /f x (1.6 m s) 2 11 /f x (409.6 m s) 2 3 /f x (1.6 m s) at f cc = 4.0 mhz 1/f cc (250 ns) 2 8 /f cc (64 m s) 1/f cc (250 ns) 2 3 /f cc (2.0 m s) 2 11 /f cc (512 m s) 2 3 /f cc (2.0 m s) remark f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) .com .com .com .com 4 .com u datasheet
chapter 9 8-bit timer/event counter 80 users manual u14643ej1v0um00 116 (4) pwm output 8-bit resolution pwm output can be produced. 9.2 8-bit timer/event counter 80 configuration 8-bit timer/event counter 80 consists of the following hardware. table 9-3. 8-bit timer/event counter 80 configuration item configuration timer counter 8 bits 1 (tm80) register compare register: 8 bits 1 (cr80) timer output 1 (to80) control register 8-bit timer mode control register 80 (tmc80) port mode register 2 (pm2) .com .com .com .com 4 .com u datasheet
chapter 9 8-bit timer/event counter 80 users manual u14643ej1v0um00 117 figure 9-1. block diagram of 8-bit timer/event counter 80 note refer to block diagram of 16-bit timer 20 remark f clk : f x or f cc (1) 8-bit compare register 80 (cr80) this is an 8-bit register that compares the value set to cr80 with the 8-bit timer counter 80 (tm80) count value, and if they match, generates an interrupt request (inttm80). cr80 is set with an 8-bit memory manipulation instruction. the values 00h to ffh can be set. reset input makes cr80 undefined. cautions 1. when rewriting cr80 in timer counter operation mode (i.e. pwme80 (bit 6 of 8-bit timer mode control register 80 (tmc80) is set to 0), be sure to stop the timer operation before hand. if cr80 is rewritten in the timer operation-enabled state, a match interrupt request signal may occur at the moment of rewrite. 2. do not set cr80 to 00h in the pwm output mode (when pwme80 = 1); otherwise, pwm may not be output normally. (2) 8-bit timer counter 80 (tm80) this is an 8-bit register to count count pulses. tm80 is read with an 8-bit memory manipulation instruction. reset input clears tm80 to 00h. internal bus internal bus 8-bit compare register 80 (cr80) match 8-bit timer counter 80 (tm80) clear ovf selector inttm80 to20 output note f clk f clk /2 3 ti80/p25/ intp2 to80/p24/ intp1/to20 pwme80 tce80 tcl801 tcl800 toe80 8-bit timer mode control register 80 (tmc80) p24 output latch pm24 r q inv s q .com .com .com .com 4 .com u datasheet
chapter 9 8-bit timer/event counter 80 users manual u14643ej1v0um00 118 9.3 8-bit timer/event counter 80 control registers the following two types of registers are used to control the 8-bit timer/event counter 80. ? 8-bit timer mode control register 80 (tmc80) ? port mode register 2 (pm2) (1) 8-bit timer mode control register 80 (tmc80) this register enables/stops operation of 8-bit timer counter 80 (tm80), sets the counter clock of tm80, and controls the operation of the output control circuit of 8-bit timer/event counter 80. tmc80 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears tmc80 to 00h. figure 9-2. 8-bit timer mode control register 80 format caution be sure to set tmc80 after stopping timer operation. remark f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) toe80 0 1 tce80 pwme80 000 tcl801tcl800 toe80 tmc80 r/w ff53h 00h r/w <6>54321 tcl801 0 0 1 1 tcl800 0 1 0 1 f x f x /2 3 tce80 0 1 (5.0 mhz) (625 khz) <7> <0> operation enable symbol address after reset 8-bit timer/event counter 80 output control output disable (port mode) output enable 8-bit timer counter 80 count clock selection rising edge of ti80 falling edge of ti80 8-bit timer counter 80 operation control operation stop (tm80 cleared to 0) pwme80 0 1 pwm output operating mode operation mode selection timer counter operating mode at f x = 5.0-mhz operation at f cc = 4.0-mhz operation f cc (4.0 mhz) f cc /2 3 (500 khz) .com .com .com .com 4 .com u datasheet
chapter 9 8-bit timer/event counter 80 users manual u14643ej1v0um00 119 (2) port mode register 2 (pm2) this register sets port 2 to input/output in 1-bit units. when using the p24/to80/intp1/to20 pin for timer output, set the output latch of pm24 and p24 to 0. pm2 is set with a 1-bit or 8-bit memory manipulation instruction. reset input sets pm2 to ffh. figure 9-3. port mode register 2 format pm2n 0 1 1 1 pm25 pm24 pm23 pm22 pm21 pm20 pm2 7654 r/w r/w 3210 input mode (output buffer off) symbol address ff22h ffh after reset p2n pin input/output mode selection (n = 0 to 5) output mode (output buffer on) .com .com .com .com 4 .com u datasheet
chapter 9 8-bit timer/event counter 80 users manual u14643ej1v0um00 120 9.4 operation of 8-bit timer/event counter 80 9.4.1 operation as interval timer the interval timer repeatedly generates an interrupt at time intervals specified by the count value set to 8-bit compare register 80 (cr80) in advance. to operate the 8-bit timer/event counter as an interval timer, the following settings are required. <1> set 8-bit timer counter 80 (tm80) to operation disable (by setting tce80 (bit 7 of 8-bit timer mode control register 80 (tmc80)) to 0). <2> set the count clock of the 8-bit timer/event counter 80 (see tables 9-4 and 9-5 ) <3> set the count value to cr80 <4> set tm80 to operation enable (tce80 = 1) when the count value of 8-bit timer counter 80 (tm80) matches the value set to cr80, the value of tm80 is cleared to 0 and tm80 continue counting. at the same time, an interrupt request signal (inttm80) is generated. tables 9-4 and 9-5 show the interval time, and figure 9-4 shows the timing of interval timer operation. cautions 1. before rewriting cr80, stop the timer operation once. if cr80 is rewritten in the timer operation-enabled state, a match interrupt request signal may occur at the moment of rewrite. 2. if the count clock setting and tm80 operation-enabled are set in tmc80 simultaneously using an 8-bit memory manipulation instruction, an error of more than one clock in one cycle may occur after the timer starts. therefore, always follow the above procedure when operating the 8-bit timer/event counter as an interval timer. table 9-4. interval time of 8-bit timer/event counter 80 (at f x = 5.0-mhz operation) tcl801 tcl800 minimum interval time maximum interval time resolution 0 0 1/f x (200 ns) 2 8 /f x (51.2 m s) 1/f x (200 ns) 012 3 /f x (1.6 m s) 2 11 /f x (409.6 m s) 2 3 /f x (1.6 m s) 1 0 ti80 input cycle 2 8 ti80 input cycle ti80 input edge cycle 1 1 ti80 input cycle 2 8 ti80 input cycle ti80 input edge cycle remark f x : system clock oscillation frequency (ceramic/crystal oscillation) table 9-5. interval time of 8-bit timer/event counter 80 (at f cc = 4.0-mhz operation) tcl801 tcl800 minimum interval time maximum interval time resolution 0 0 1/f cc (250 ns) 2 8 /f cc (64 m s) 1/f cc (250 ns) 012 3 /f cc (2.0 m s) 2 11 /f cc (512 m s) 2 3 /f cc (2.0 m s) 1 0 ti80 input cycle 2 8 ti80 input cycle ti80 input edge cycle 1 1 ti80 input cycle 2 8 ti80 input cycle ti80 input edge cycle remark f cc : system clock oscillation frequency (rc oscillation) .com .com .com .com 4 .com u datasheet
chapter 9 8-bit timer/event counter 80 users manual u14643ej1v0um00 121 figure 9-4. interval timer operation timing remark interval time = (n + 1) t : n = 00h to ffh clear clear interrupt accept interrupt accept count start interval time interval time interval time count clock tm80 count value cr80 tce80 inttm80 to80 n 01h 00h n 01h 00h n 00h 01h nn nn t .com .com .com .com 4 .com u datasheet
chapter 9 8-bit timer/event counter 80 users manual u14643ej1v0um00 122 9.4.2 operation as external event counter the external event counter counts the number of external clock pulses input to the ti80/p25/intp2 pin by using 8-bit timer counter 80 (tm80). to operate the 8-bit timer/event counter 80 as an external event counter, the following settings are required. <1> set p25 to input mode (pm25 = 1) <2> set 8-bit timer counter 80 (tm80) to operation disable (by setting tce80 (bit 7 of 8-bit timer mode control register 80 (tmc80)) to 0). <3> specify the rising/falling edges of ti80 (see tables 9-4 and 9-5 ), and set to80 to output disable (i.e. set toe80 (bit 0 of tmc80) to 0) and pwm output to disable (i.e. set pwme80 (bit 6 of tmc80) to 0). <4> set the count value to cr80. <5> set tm80 to operation enable (tce80 = 1) each time the valid edge specified by bit 1 (tcl800) of tmc80 is input, the value of 8-bit timer counter 80 (tm80) is incremented. when the count value of tm80 matches the value set to cr80, the value of tm80 is cleared to 0 and tm80 continues counting. at the same time, an interrupt request signal (inttm80) is generated. figure 9-5 shows the timing of the external event counter operation (with rising edge specified). cautions 1. before rewriting cr80, stop the timer operation once. if cr80 is rewritten in the timer operation-enabled state, a match interrupt request signal may occur at the moment of rewrite. 2. if the count clock setting and tm80 operation-enabled are set in tmc80 simultaneously using an 8-bit memory manipulation instruction, an error of more than one clock in one cycle may occur after the timer starts. therefore, always follow the above procedure when operating the 8-bit timer/event counter as an interval timer. figure 9-5. external event counter operation timing (with rising edge specified) remark n = 00h to ffh ti80 pin input tm80 count value cr80 tce80 inttm80 00h 01h 02h 03h 04h 05h n ?1 n 00h 01h 02h 03h n .com .com .com .com 4 .com u datasheet
chapter 9 8-bit timer/event counter 80 users manual u14643ej1v0um00 123 9.4.3 operation as square wave output the 8-bit timer/event counter can generate output square waves of a given frequency at intervals specified by the count value set to the 8-bit compare register 80 (cr80) in advance. to operate the 8-bit timer/event counter 80 for square wave output, the following settings are required. <1> set p24 to output mode (pm24 = 0) and the p24 output latch to 0. <2> set 8-bit timer counter 80 (tm80) to operation disable (tce80 = 0). <3> set the count clock of the 8-bit timer/event counter 80 (see tables 9-4 and 9-5 ), to80 to output enable (toe80 = 1), and pwm output to disable (pwme80 = 0). <4> set the count value to cr80. <5> set tm80 to operation enable (tce80 = 1). when the count value of 8-bit timer counter 80 (tm80) matches the value set in cr80, the to80/p24/intp1/to20 pin output will be inverted. through application of this mechanism, square waves of any frequency can be output. as soon as a match occurs, the tm80 value is cleared to 0 and tm80 continues counting. at the same time, an interrupt request signal (inttm80) is generated. square wave output is cleared (0) when bit 7 (tce80) in tmc80 is set to 0. table 9-6 shows square wave output range, and figure 9-6 shows timing of square wave output. cautions 1. before rewriting cr80, stop the timer operation once. if cr80 is rewritten in the timer operation-enabled state, a match interrupt request signal may occur at the moment of rewrite. 2. if the count clock setting and tm80 operation-enabled are set in tmc80 simultaneously using an 8-bit memory manipulation instruction, an error of more than one clock in one cycle may occur after the timer starts. therefore, always follow the above procedure when operating the 8-bit timer/event counter as an interval timer. table 9-6. square wave output range of 8-bit timer/event counter 80 (at f x = 5.0-mhz operation) tcl801 tcl800 minimum pulse width maximum pulse width resolution 0 0 1/f x (200 ns) 2 8 /f x (51.2 m s) 1/f x (200 ns) 012 3 /f x (1.6 m s) 2 11 /f x (409.6 m s) 2 3 /f x (1.6 m s) remark f x : system clock oscillation frequency (ceramic/crystal oscillation) table 9-7. square wave output range of 8-bit timer/event counter 80 (at f cc = 4.0-mhz operation) tcl801 tcl800 minimum pulse width maximum pulse width resolution 0 0 1/f cc (250 ns) 2 8 /f cc (64 m s) 1/f cc (250 ns) 012 3 /f cc (2.0 m s) 2 11 /f cc (512 m s) 2 3 /f cc (2.0 m s) remark f cc : system clock oscillation frequency (rc oscillation) .com .com .com .com 4 .com u datasheet
chapter 9 8-bit timer/event counter 80 users manual u14643ej1v0um00 124 figure 9-6. square wave output timing note the initial value of to80 during output enable (toe80 = 1) becomes low level. clear clear interrupt accept interrupt accept count start count clock tm80 count value cr80 tce80 inttm80 to80 note n 01h 00h n 01h 00h n 00h 01h nn nn .com .com .com .com 4 .com u datasheet
chapter 9 8-bit timer/event counter 80 users manual u14643ej1v0um00 125 9.4.4 operation as pwm output pwm output enables interrupt generation repeatedly at intervals specified by the count value set to 8-bit compare register 80 (cr80) in advance. to use 8-bit timer/counter 80 for pwm output, the following settings are required. <1> set p24 to output mode (pm24 = 0) and the p24 output latch to 0. <2> set 8-bit timer counter 80 (tm80) to operation disable (tce80 = 0). <3> set the count clock of the 8-bit timer/event counter 80 (see tables 9-4 and 9-5 ), to80 to output enable (toe80 = 1), and pwm output to enable (pwme80 = 1). <4> set the count value to cr80 <5> set tm80 to operation enable (tce80 = 1) when the count value of 8-bit timer counter 80 (tm80) matches the value set to cr80, tm80 continues counting, and an interrupt request signal (inttm80) is generated. cautions 1. when cr80 is rewritten during timer operation, a high level may be output for the next one cycle (refer to 9.5 (2) setting of 8-bit compare register 80). 2. if the count clock setting and tm80 operation-enabled are set in tmc80 simultaneously using an 8-bit memory manipulation instruction, an error of more than one clock in one cycle may occur after the timer starts. therefore, always follow the above procedure when operating 8-bit compare register 80 as a pwm output. .com .com .com .com 4 .com u datasheet
chapter 9 8-bit timer/event counter 80 users manual u14643ej1v0um00 126 figure 9-7. pwm output timing note the initial value of to80 upon output enable (toe80 = 1) is low level. caution do not set cr80 to 00h in the pwm output mode; otherwise pwm may not be output normally. count clock tm80 cr80 tce80 inttm80 m = 01h to ffh ovf to80 note 00h 01h m ?? m ?? ffh 00h 01h 02h ?? m m + 1 m + 2 ?? ffh 00h 01h ?? m ?? ?? .com .com .com .com 4 .com u datasheet
chapter 9 8-bit timer/event counter 80 users manual u14643ej1v0um00 127 9.5 notes on using 8-bit timer/event counter 80 (1) error on starting timer an error of up to 1 clock occurs after the timer has been started until a coincidence signal is generated. this is because 8-bit timer counter 80 (tm80) is started in asynchronization with the count pulse. figure 9-8. start timing of 8-bit timer counter (2) setting of 8-bit compare register 80 8-bit compare register 80 (cr80) can be set to 00h. therefore, one pulse can be counted when the 8-bit timer/event counter operates as an event counter. figure 9-9. external event counter operation timing cautions 1. when rewriting cr80 in timer counter operation mode (i.e. pwme80 (bit 6 of 8-bit timer mode control register 80 (tmc80) is set to 0), be sure to stop the timer operation before hand. if cr80 is rewritten in the timer operation-enabled state, a match interrupt request signal may occur at the moment of rewrite. count pulse tm80 count value timer start 00h 01h 02h 03h 04h tl80 input cr80 00h tm80 count value 00h 00h 00h 00h interrupt request flag .com .com .com .com 4 .com u datasheet
chapter 9 8-bit timer/event counter 80 users manual u14643ej1v0um00 128 2. when rewriting cr80 in pwm output operation mode (pwme80 = 1), a high level may be output for the next one cycle (count pulse x 256). this phenomenon occurs if a value smaller than the value of tm80 is written to cr80. 3. do not set cr80 to 00h in the pwm output mode (when pwme80 = 1); otherwise, pwm may not be output normally. to80 m = 02h-ffh rewriting to cr80 m ? 01h m 01h 00h ? m ? ffh 00h 01h 02h ? ffh 00h 01h ?? match signal ovf tce80 cr80 tm80 count clock 01h .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 129 chapter 10 watchdog timer the watchdog timer can generate non-maskable interrupts, maskable interrupts and reset with arbitrary preset intervals. 10.1 functions of watchdog timer the watchdog timer has the following functions: ? watchdog timer ? interval timer caution select the watchdog timer mode or interval timer mode by using the watchdog timer mode register (wdtm). (1) watchdog timer the watchdog timer is used to detect program runaway. when a runaway is detected, a non-maskable interrupt or the reset signal can be generated. table 10-1. runaway detection time of watchdog timer runaway at f x = 5.0-mhz operation at f cc = 4.0-mhz operation detection time 2 11 1/f w 410 m s 512 m s 2 13 1/f w 1.64 ms 2.05 ms 2 15 1/f w 6.55 ms 8.19 ms 2 17 1/f w 26.2 ms 32.8 ms f w :f x or f cc f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) (2) interval timer the interval timer generates an interrupt at a given interval set in advance. table 10-2. interval time interval time at f x = 5.0-mhz operation at f cc = 4.0-mhz operation 2 11 1/f w 410 m s 512 m s 2 13 1/f w 1.64 ms 2.05 ms 2 15 1/f w 6.55 ms 8.19 ms 2 17 1/f w 26.2 ms 32.8 ms f w :f x or f cc f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) .com .com .com .com 4 .com u datasheet
chapter 10 watchdog timer users manual u14643ej1v0um00 130 10.2 configuration of watchdog timer the watchdog timer consists of the following hardware: table 10-3. configuration of watchdog timer item configuration control register timer clock select register 2 (tcl2) watchdog timer mode register (wdtm) figure 10-1. block diagram of watchdog timer remark f w : f x or f cc internal bus internal bus prescaler selector control circuit f w 2 6 f w 2 8 f w 2 10 3 7-bit counter tmif4 tmmk4 tcl22 tcl21 tcl20 timer clock select register 2 (tcl2) watchdog timer mode register (wdtm) clear wdtm4 run wdtm3 intwdt maskable interrupt request reset intwdt non-maskable interrupt request f w 2 4 .com .com .com .com 4 .com u datasheet
chapter 10 watchdog timer users manual u14643ej1v0um00 131 10.3 watchdog timer control register the following two types of registers are used to control the watchdog timer. ? timer clock select register 2 (tcl2) ? watchdog timer mode register (wdtm) (1) timer clock select register 2 (tcl2) this register sets the watchdog timer count clock. tcl2 is set with an 8-bit memory manipulation instruction. reset input clears tcl2 to 00h. figure 10-2. timer clock select register 2 format remark f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) tcl22 0 0 1 1 00000 tcl22 tcl21 tcl20 tcl2 r/w r/w 76543210 tcl21 0 1 0 1 f x /2 4 f x /2 6 f x /2 8 f x /2 10 (312.5 khz) (78.1 khz) (19.5 khz) (4.88 khz) tcl20 0 0 0 0 setting prohibited symbol address ff42h 00h after reset other than above watchdog timer count clock selection 2 11 /f x 2 13 /f x 2 15 /f x 2 17 /f x (410 s) (1.64 ms) (6.55 ms) (26.2 ms) interval time m f cc /2 4 (250 khz) f cc /2 10 (3.91 khz) f cc /2 6 (62.5 khz) f cc /2 8 (15.6 khz) 2 11 /f cc (512 s) 2 13 /f cc (2.05 ms) 2 17 /f cc (32.8 ms) 2 15 /f cc (8.19 ms) m at f x = 5.0-mhz operation at f cc = 4.0-mhz operation at f cc = 4.0-mhz operation at f x = 5.0-mhz operation .com .com .com .com 4 .com u datasheet
chapter 10 watchdog timer users manual u14643ej1v0um00 132 (2) watchdog timer mode register (wdtm) this register sets an operation mode of the watchdog timer, and enables/disables counting of the watchdog timer. wdtm is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears wdtm to 00h. figure 10-3. format of watchdog timer mode register notes 1. once run has been set (1), it cannot be cleared (0) by software. therefore, when counting is started, it cannot be stopped by any means other than reset input. 2. once wdtm3 and wdtm4 have been set (1), they cannot be cleared (0) by software. 3. the watchdog timer starts operations as an interval timer when run is set to 1. cautions 1. when the watchdog timer is cleared by setting run to 1, the actual overflow time is up to 0.8% shorter than the time set by timer clock select register 2 (tcl2). 2. in watchdog timer mode 1 or 2, set wdtm4 to 1 after confirming tmif4 (bit 0 of interrupt request flag 0) has been set to 0. when watchdog timer mode 1 or 2 is selected under the condition where tmif4 is 1, a non-maskable interrupt occurs at the completion of rewriting. run 0 1 selects operation of watchdog timer note 1 run 0 0 wdtm4 wdtm3 000 wdtm symbol address after reset r/w fff9h 00h r/w <7>6543210 stops counting clears counter and starts counting wdtm4 selects operation mode of watchdog timer note 2 wdtm3 0 1 1 0 1 1 operation stop interval timer mode (overflow and maskable interrupt occur) note 3 watchdog timer mode 1 (overflow and non-maskable interrupt occur) watchdog timer mode 2 (overflow occurs and reset operation started) 0 0 .com .com .com .com 4 .com u datasheet
chapter 10 watchdog timer users manual u14643ej1v0um00 133 10.4 operation of watchdog timer 10.4.1 operation as watchdog timer the watchdog timer operates to detect a runaway when bit 4 (wdtm4) of the watchdog timer mode register (wdtm) is set to 1. the count clock (runaway detection time interval) of the watchdog timer can be selected by bits 0 to 2 (tcl20 to tcl22) of timer clock select register 2 (tcl2). by setting bit 7 (run) of wdtm to 1, the watchdog timer is started. set run to 1 within the set runaway detection time interval after the watchdog timer has been started. by setting run to 1, the watchdog timer can be cleared and start counting. if run is not set to 1, and the runaway detection time is exceeded, the system is reset or a non-maskable interrupt is generated by the value of bit 3 (wdtm3) of wdtm. the watchdog timer continues operation in the halt mode, but stops in the stop mode. therefore, set run to 1 before entering the stop mode to clear the watchdog timer, and then execute the stop instruction. caution the actual runaway detection time may be up to 0.8% shorter than the set time. table 10-4. runaway detection time of watchdog timer tcl22 tcl21 tcl20 runaway detection time at f x = 5.0-mhz operation at f cc = 4.0-mhz operation 00 02 11 1/f w 410 m s 512 m s 01 02 13 1/f w 1.64 ms 2.05 ms 10 02 15 1/f w 6.55 ms 8.19 ms 11 02 17 1/f w 26.2 ms 32.8 ms f w :f x or f cc f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) .com .com .com .com 4 .com u datasheet
chapter 10 watchdog timer users manual u14643ej1v0um00 134 10.4.2 operation as interval timer when bits 4 and 3 (wdtm4, wdtm3) of watchdog timer mode register (wdtm) are set to 1, the watchdog timer also operates as an interval timer that repeatedly generates an interrupt at time intervals specified by a count value set in advance. select a count clock (or interval time) by setting bits 0 to 2 (tcl20 to tcl22) of timer clock select register 2 (tcl2). the watchdog timer starts operation as an interval timer when the run bit (bit 7 of wdtm) is set to 1. in the interval timer mode, the interrupt mask flag (tmmk4) is valid, and a maskable interrupt (intwdt) can be generated. the priority of intwdt is set as the highest of all the maskable interrupts. the interval timer continues operation in the halt mode, but stops in the stop mode. therefore, set run to 1 before entering the stop mode to clear the interval timer, and then execute the stop instruction. cautions 1. once bit 4 (wdtm4) of wdtm is set to 1 (when the watchdog timer mode is selected), the interval timer mode is not set, unless the reset signal is input. 2. the interval time immediately after the setting by wdtm may be up to 0.8% shorter than the set time. table 10-5. interval time of interval timer tcl22 tcl21 tcl20 interval time at f x = 5.0-mhz operation at f cc = 4.0-mhz operation 00 02 11 1/f w 410 m s 512 m s 01 02 13 1/f w 1.64 ms 2.05 ms 10 02 15 1/f w 6.55 ms 8.19 ms 11 02 17 1/f w 26.2 ms 32.8 ms f w :f x or f cc f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 135 chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) 11.1 8-bit a/d converter functions the 8-bit a/d converter is an 8-bit resolution converter to convert analog input to digital signals. this converter can control up to four channels of analog inputs (ani0 to ani3). a/d conversion can only be started by software. one of analog inputs ani0 to ani3 is selected for a/d conversion. a/d conversion is performed repeatedly, with an interrupt request (intad0) being issued each time an a/d session is completed. 11.2 8-bit a/d converter configuration the 8-bit a/d converter consists of the following hardware. table 11-1. configuration of 8-bit a/d converter item configuration analog input 4 channels (ani0 to ani3) register successive approximation register (sar) a/d conversion result register 0 (adcr0) control register a/d converter mode register 0 (adm0) analog input channel specification register 0 (ads0) .com .com .com .com 4 .com u datasheet
chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) users manual u14643ej1v0um00 136 figure 11-1. block diagram of 8-bit a/d converter (1) successive approximation register (sar) the sar receives the result of comparing an analog input voltage and a voltage at a voltage tap (comparison voltage), received from the series resistor string, starting from the most significant bit (msb). upon receiving all the bits, down to the least significant bit (lsb), that is, upon the completion of a/d conversion, the sar sends its contents to a/d conversion result register 0 (adcr0). (2) a/d conversion result register 0 (adcr0) adcr0 holds the result of a/d conversion. each time a/d conversion ends, the conversion result received from the successive approximation register is loaded into adcr0, which is an 8-bit register that holds the result of a/d conversion. adcr0 can be read with an 8-bit memory manipulation instruction. reset input makes this register undefined. (3) sample and hold circuit the sample and hold circuit samples consecutive analog inputs from the input circuit, one by one, and sends them to the voltage comparator. the sampled analog input voltage is held during a/d conversion. (4) voltage comparator the voltage comparator compares an analog input with the voltage output by the series resistor string. ani0/p60 ani1/p61 ani2/p62 ani3/p63 selector sample and hold circuit voltage comparator successive approximation register (ar) control circuit 2 a/d conversion result register 0 (adcr0) tap selector av ss intad0 a/d converter mode register 0 (adm0) analog input channel specification register 0 (ads0) internal bus av ss adcs0 fr02 fr01 fr00 ads01 ads00 p-ch av dd .com .com .com .com 4 .com u datasheet
chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) users manual u14643ej1v0um00 137 (5) series resistor string the series resistor string is configured between av dd and av ss . it generates the reference voltages against which analog inputs are compared. (6) ani0 to ani3 pins pins ani0 to ani3 are the 4-channel analog input pins for the a/d converter. they are used to receive the analog signals for a/d conversion. caution do not supply pins ani0 to ani3 with voltages that fall outside the rated range. if a voltage greater than av dd or less than av ss (even if within the absolute maximum rating) is supplied to any of these pins, the conversion value for the corresponding channel will be undefined. furthermore, the conversion values for the other channels may also be affected. (7) av ss pin the av ss pin is a ground potential pin for the a/d converter. this pin must be held at the same potential as the v ss pin, even while the a/d converter is not being used. (8) av dd pin the av dd pin is an analog power supply pin for the a/d converter. this pin must be held at the same potential as the v dd pin, even while the a/d converter is not being used. .com .com .com .com 4 .com u datasheet
chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) users manual u14643ej1v0um00 138 11.3 registers controlling 8-bit a/d converter the following two registers are used to control the 8-bit a/d converter. ? a/d converter mode register 0 (adm0) ? analog input channel specification register 0 (ads0) (1) a/d converter mode register 0 (adm0) adm0 specifies the conversion time for analog inputs. it also specifies whether to enable conversion. adm0 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears adm0 to 00h. figure 11-2. format of a/d converter mode register 0 notes 1. the specifications of fr02, fr01, and fr00 must be such that the a/d conversion time is at least 14 m s. 2. these bit combinations must not be used, as the a/d conversion time will fall below 14 m s. cautions 1. the result of conversion performed immediately after bit 7 (adcs0) is set is undefined. 2. the result of conversion after adcs0 is cleared may be undefined (for details, refer to 11.5 (5) timing when a/d conversion result become undefined). remark f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) a/d conversion control adcs0 0 fr02 fr01 fr00 0 0 0 adm0 symbol address after reset r/w ff80h 00h r/w <7>6543210 adcs0 0 1 a/d conversion time selection note 1 fr02 0 0 0 1 1 1 144/f x 120/f x 96/f x 72/f x 60/f x 48/f x fr01 0 0 1 0 0 1 (28.8 s) (24 s) (19.2 s) (14.4 s) (setting prohibited note 2 ) (setting prohibited note 2 ) (36 s) (30 s) (24 s) (18 s) (15 s) (setting prohibited note 2 ) m m m fr00 0 1 0 0 1 0 other than above conversion disabled conversion enabled setting prohibited m 144/f cc 120/f cc 96/f cc 72/f cc 60/f cc 48/f cc m m m m m at f cc = 4.0-mhz operation at f x = 5.0-mhz operation .com .com .com .com 4 .com u datasheet
chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) users manual u14643ej1v0um00 139 (2) analog input channel specification register 0 (ads0) the ads0 register specifies the port used to input the analog voltages to be converted to a digital signal. ads0 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears ads0 to 00h. figure 11-3. format of analog input channel specification register 0 000000 ads01 ads00 ads0 symbol address after reset r/w ff84h 00h r/w 76543210 analog input channel specification ani0 ani1 ani2 ani3 ads01 0 0 1 1 ads00 0 1 0 1 .com .com .com .com 4 .com u datasheet
chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) users manual u14643ej1v0um00 140 11.4 8-bit a/d converter operation 11.4.1 basic operation of 8-bit a/d converter <1> select a channel for a/d conversion, using analog input channel specification register 0 (ads0). <2> the voltage supplied to the selected analog input channel is sampled using the sample and hold circuit. <3> after sampling continues for a certain period of time, the sample and hold circuit is put on hold to keep the input analog voltage until a/d conversion is completed. <4> bit 7 of the successive approximation a/d conversion register (sar) is set. the series resistor string voltage tap at the tap selector is set to half of av dd . <5> the series resistor string tap voltage is compared with the analog input voltage using the voltage comparator. if the analog input voltage is higher than half of av dd , the msb of the sar is left set. if it is lower than half of av dd , the msb is reset. <6> bit 6 of the sar is set automatically, and comparison shifts to the next stage. the next voltage tap of the series resistor string is selected according to bit 7, which reflects the previous comparison result, as follows: ? bit 7 = 1: three quarters of av dd ? bit 7 = 0: one quarter of av dd the tap voltage is compared with the analog input voltage. bit 6 is set or reset according to the result of comparison. ? analog input voltage 3 tap voltage: bit 6 = 1 ? analog input voltage < tap voltage: bit 6 = 0 <7> comparison is repeated until bit 0 of the sar is reached. <8> when comparison is completed for all of the 8 bits, a significant digital result is left in the sar. this value is sent to and latched in a/d conversion result register 0 (adcr0). at the same time, it is possible to generate an a/d conversion end interrupt request (intad0). cautions 1. the first a/d conversion value immediately after starting the a/d conversion operation may be undefined. 2. when in standby mode, the a/d converter stops operation. .com .com .com .com 4 .com u datasheet
chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) users manual u14643ej1v0um00 141 figure 11-4. basic operation of 8-bit a/d converter a/d conversion continues until bit 7 (adcs0) of a/d converter mode register 0 (adm0) is reset (0) by software. if an attempt is made to write to adm0 or analog input channel specification register 0 (ads0) during a/d conversion, the ongoing a/d conversion is canceled. in this case, if adcs0 is set (1), a/d conversion is restarted from the beginning. reset input makes the a/d conversion result register 0 (adcr0) undefined. 11.4.2 input voltage and conversion result the relationships between the analog input voltage at the analog input pins (ani0 to ani3) and the a/d conversion result (a/d conversion result register 0 (adcr0)) are represented by: adcr0 = int ( 256 + 0.5) or (adcr0 C 0.5) v in < (adcr0 + 0.5) int( ): function that returns the integer part of a parenthesized value v in : analog input voltage av dd : a/d converter supply voltage adcr0: value in the a/d conversion result register 0 (adcr0) figure 11-5 shows the relationships between the analog input voltage and the a/d conversion result. av dd 256 v in av dd av dd 256 conversion time sampling time sampling a/d conversion undefined 80h c0h or 40h conversion result conversion result a/d converter operation sar adcr0 intad0 .com .com .com .com 4 .com u datasheet
chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) users manual u14643ej1v0um00 142 figure 11-5. relationships between analog input voltage and a/d conversion result 255 254 253 3 2 1 0 a/d conversion result (adcr0) 1 512 1 256 3 512 2 256 5 512 3 256 507 512 254 256 509 512 255 256 511 512 1 input voltage/av dd .com .com .com .com 4 .com u datasheet
chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) users manual u14643ej1v0um00 143 11.4.3 operation mode of 8-bit a/d converter the 8-bit a/d converter is initially in the select mode. in this mode, analog input channel specification register 0 (ads0) is used to select an analog input channel from ani0 to ani3 for a/d conversion. a/d conversion can only be started by software, that is, by setting a/d converter mode register 0 (adm0). the a/d conversion result is saved to a/d conversion result register 0 (adcr0). at the same time, an interrupt request signal (intad0) is generated. ? software-started a/d conversion setting bit 7 (adcs0) of a/d converter mode register 0 (adm0) triggers a/d conversion for the voltage applied to the analog input pin specified in analog input channel specification register 0 (ads0). upon completion of a/d conversion, the conversion result is saved to a/d conversion result register 0 (adcr0). at the same, an interrupt request signal (intad0) is generated. once a/d conversion is activated, and completed, another session of a/d conversion is started. a/d conversion is repeated until new data is written to adm0. if data where adcs0 is 1 is written to adm0 again during a/d conversion, the ongoing session of a/d conversion is discontinued, and a new session of a/d conversion begins for the new data. if data where adcs0 is 0 is written to the adm0 again during a/d conversion, a/d conversion is completely stopped. figure 11-6. software-started a/d conversion remarks 1. n = 0, 1, 2, 3 2. m = 0, 1, 2, 3 rewriting adm0 adcs0 = 1 rewriting adm0 adcs0 = 1 adcs0 = 0 a/d conversion adcr0 intad0 anin anin anin anim anim stop anin anin anim conversion is discontinued; no conversion result is preserved. .com .com .com .com 4 .com u datasheet
chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) users manual u14643ej1v0um00 144 11.5 cautions related to 8-bit a/d converter (1) current consumption in the standby mode when the a/d converter enters the standby mode, it stops its operation. stopping conversion (bit 7 (adcs0) of a/d converter mode register 0 (adm0) = 0) can reduce the current consumption. figure 11-7 shows how to reduce the current consumption in the standby mode. figure 11-7. how to reduce current consumption in standby mode (2) input range for the ani0 to ani3 pins be sure to keep the input voltage at ani0 to ani3 within its rating. if a voltage not lower than av dd or not higher than av ss (even within the absolute maximum rating) is input to a conversion channel, the conversion output of the channel becomes undefined. it may affect the conversion output of the other channels. (3) conflict <1> conflict between writing to a/d conversion result register 0 (adcr0) at the end of conversion and reading from adcr0 reading from adcr0 takes precedence. after reading, the new conversion result is written to the adcr0. <2> conflict between writing to adcr0 at the end of conversion and writing to a/d converter mode register 0 (adm0) or analog input channel specification register 0 (ads0) writing to adm0 or ads0 takes precedence. a request to write to adcr0 is ignored. no conversion end interrupt request signal (intad0) is generated. av dd av ss p-ch series resistor string adcs0 .com .com .com .com 4 .com u datasheet
chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) users manual u14643ej1v0um00 145 (4) conversion results immediately following start of a/d conversion the first a/d conversion value immediately following the start of a/d converter operation may be undefined. be sure to poll the a/d conversion end interrupt request (intad0) and perform processing such as annulling the first conversion result. (5) timing that makes the a/d conversion result undefined if the timing of the end of a/d conversion and the timing of the stop of operation of the a/c converter conflict, the a/d conversion value may be undefined. because of this, be sure to read out the a/d conversion result while the a/d converter is in operation. furthermore, when reading out an a/d conversion result after a/d converter operation has stopped, be sure to have done so by the time the next conversion result is complete. the conversion result readout timing is shown in figures 11-8 and 11-9. figure 11-8. conversion result readout timing (when conversion result is undefined value) figure 11-9. conversion result readout timing (when conversion result is normal value) a/d conversion end a/d conversion end normal conversion result undefined value normal conversion result read out undefined value read out a/d operation stopped adcr0 intad0 adcs0 normal conversion result a/d conversion end normal conversion result read out a/d operation stopped adcr0 intad0 adcs0 .com .com .com .com 4 .com u datasheet
chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) users manual u14643ej1v0um00 146 (6) noise prevention to maintain a resolution of 8 bits, watch for noise to the av dd and ani0 to ani3 pins. the higher the output impedance of the analog input source is, the larger the effect by noise. to reduce noise, attach an external capacitor to the relevant pins as shown in figure 11-8. figure 11-10. analog input pin treatment (7) ani0 to ani3 the analog input pins (ani0 to ani3) are alternate-function pins. they are used also as port pins (p60 to p63). if any of ani0 to ani3 has been selected for a/d conversion, do not execute input instructions for the ports; otherwise the conversion resolution may become lower. if a digital pulse is applied to a pin adjacent to the analog input pins during a/d conversion, coupling noise may occur which prevents an a/d conversion result from being attained as expected. avoid applying a digital pulse to pins adjacent to the analog input pins during a/d conversion. (8) interrupt request flag (adif0) changing the content of a/d converter mode register 0 (adm0) does not clear the interrupt request flag (adif0). if the analog input pins are changed during a/d conversion, therefore, the conversion result and the conversion end interrupt request flag may reflect the previous analog input immediately before writing to adm0 occurs. in this case, adif0 may appear to be set if it is read-accessed immediately after adm0 is write-accessed, even when a/d conversion has not been completed for the new analog input. in addition, when a/d conversion is restarted, adif0 must be cleared beforehand. c = 100 to 1000 pf if noise not lower than av dd or not higher than av ss is likely to come to the av dd pin, clamp the voltage at the pin by attaching a diode with a small v f (0.3 v or lower). av ss v ss av dd v dd .com .com .com .com 4 .com u datasheet
chapter 11 8-bit a/d converter ( m pd789104a, 789124a subseries) users manual u14643ej1v0um00 147 figure 11-11. a/d conversion end interrupt request generation timing remarks 1. n = 0, 1, 2, 3 2. m = 0, 1, 2, 3 (9) av dd pin the av dd pin is used to supply power to the analog circuit. it is also used to supply power to the ani0 to ani3 input circuit. therefore, if the application is designed to be switched to backup power, the av dd pin must be supplied with the same voltage level as for the v dd pin, as shown in figure 11-12. figure 11-12. av dd pin treatment (10) input impedance of the av dd pin a series resistor string of several 10 k w is connected across the av dd and av ss pins. therefore, if the output impedance of the reference voltage source is high, this high impedance is eventually connected in parallel with the series resistor string across the av dd and av ss pins, leading to a higher reference voltage error. rewriting to adm0 (to begin conversion for anin) a/d conversion adcr0 intad0 anin anin anim anin anin anim anim anim rewriting to adm0 (to begin conversion for anim) adif0 has been set, but conversion for anim has not been completed. main power source backup capacitor v dd av dd v ss av ss .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 148 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 149 chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) 12.1 10-bit a/d converter functions the 10-bit a/d converter is a 10-bit resolution converter to convert an analog input to digital signals. this converter can control up to four channels of analog inputs (ani0 to ani3). a/d conversion can only be started by software. one of analog inputs ani0 to ani3 is selected for a/d conversion. a/d conversion is performed repeatedly, with an interrupt request (intad0) being issued each time an a/d session is completed. 12.2 10-bit a/d converter configuration the a/d converter consists of the following hardware. table 12-1. configuration of 10-bit a/d converter item configuration analog input 4 channels (ani0 to ani3) register successive approximation register (sar) a/d conversion result register 0 (adcr0) control register a/d converter mode register 0 (adm0) analog input channel specification register 0 (ads0) .com .com .com .com 4 .com u datasheet
chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) users manual u14643ej1v0um00 150 figure 12-1. block diagram of 10-bit a/d converter (1) successive approximation register (sar) the sar receives the result of comparing an analog input voltage and a voltage at a voltage tap (comparison voltage), received from the series resistor string, starting from the most significant bit (msb). upon receiving all the bits, down to the least significant bit (lsb), that is, upon the completion of a/d conversion, the sar sends its contents to a/d conversion result register 0 (adcr0). (2) a/d conversion result register 0 (adcr0) adcr0 holds the result of a/d conversion. each time a/d conversion ends, the conversion result received from the successive approximation register is loaded into adcr0, which is a 10-bit register the holds the result of a/d conversion. adcr0 can be read with an 8-bit memory manipulation instruction. reset input makes this register undefined. caution when using the m pd78F9116A as a flash memory version of the m pd789101a, 789102a, or 789104a, or the m pd78f9136a as a flash memory version of the m pd789121a, 789122a, or 789124a, an 8-bit access can be made by adcr0. however, it is performed only with the object file assembled by the m pd789101a, 789102a, or 789104a, or by the m pd789121a, 789122a, or 789124a, respectively. sample and hold circuit voltage comparator successive approximation register (sar) control circuit 2 a/d conversion result register 0 (adcr0) tap selector av ss intad0 a/d converter mode register 0 (adm0) analog input channel specification register 0 (ads0) internal bus av ss p-ch av dd ani0/p60 ani1/p61 ani2/p62 ani3/p63 selector adcs0 fr02 fr01 fr00 ads01 ads00 .com .com .com .com 4 .com u datasheet
chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) users manual u14643ej1v0um00 151 (3) sample and hold circuit the sample-and-hold circuit samples consecutive analog inputs from the input circuit, one by one, and sends them to the voltage comparator. the sampled analog input voltage is held during a/d conversion. (4) voltage comparator the voltage comparator compares an analog input with the voltage output by the series resistor string. (5) series resistor string the series resistor string is configured between av dd and av ss . it generates the reference voltages against which analog inputs are compared. (6) ani0 to ani3 pins pins ani0 to ani3 are the 4-channel analog input pins for the a/d converter. they are used to receive the analog signals for a/d conversion. caution do not supply pins ani0 to ani3 with voltages that fall outside the rated range. if a voltage greater than av dd or less than av ss (even if within the absolute maximum rating) is supplied to any of these pins, the conversion value for the corresponding channel will be undefined. furthermore, the conversion values for the other channels may also be affected. (7) av ss pin the av ss pin is a ground potential pin for the a/d converter. this pin must be held at the same potential as the v ss pin, even while the a/d converter is not being used. (8) av dd pin the av dd pin is an analog power supply pin for the a/d converter. this pin must be held at the same potential as the v dd pin, even while the a/d converter is not being used. .com .com .com .com 4 .com u datasheet
chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) users manual u14643ej1v0um00 152 12.3 registers controlling 10-bit a/d converter the following two registers are used to control the 10-bit a/d converter. ? a/d converter mode register 0 (adm0) ? analog input channel specification register 0 (ads0) (1) a/d converter mode register 0 (adm0) adm0 specifies the conversion time for analog inputs. it also specifies whether to enable conversion. adm0 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears the adm0 to 00h. figure 12-2. format of a/d converter mode register 0 notes 1. the specifications of fr02, fr01, and fr00 must be such that the a/d conversion time is at least 14 m s. 2. these bit combinations must not be used, as the a/d conversion time will fall below 14 m s. cautions 1. the result of conversion performed immediately after bit 7 (adcs0) is set is undefined. 2. the result of conversion after adcs0 is cleared may be undefined (for details, refer to 12.5 (5) timing when a/d conversion result becomes undefined). remark f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) a/d conversion control adcs0 0 fr02 fr01 fr00 0 0 0 adm0 symbol address after reset r/w ff80h 00h r/w <7>6543210 adcs0 0 1 a/d conversion time selection note 1 fr02 0 0 0 1 1 1 144/f x 120/f x 96/f x 72/f x 60/f x 48/f x fr01 0 0 1 0 0 1 (28.8 s) (24 s) (19.2 s) (14.4 s) (setting prohibited note 2 ) (setting prohibited note 2 ) (36 s) (30 s) (24 s) (18 s) (15 s) (setting prohibited note 2 ) m m m fr00 0 1 0 0 1 0 other than above conversion disabled conversion enabled setting prohibited m 144/f cc 120/f cc 96/f cc 72/f cc 60/f cc 48/f cc m m m m m at f cc = 4.0-mhz operation at f x = 5.0-mhz operation .com .com .com .com 4 .com u datasheet
chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) users manual u14643ej1v0um00 153 (2) analog input channel specification register 0 (ads0) the ads0 register specifies the port used to input the analog voltages to be converted to a digital signal. ads0 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears ads0 to 00h. figure 12-3. format of analog input channel specification register 0 000000 ads01 ads00 ads0 symbol address after reset r/w ff84h 00h r/w 76543210 analog input channel specification ani0 ani1 ani2 ani3 ads01 0 0 1 1 ads00 0 1 0 1 .com .com .com .com 4 .com u datasheet
chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) users manual u14643ej1v0um00 154 12.4 10-bit a/d converter operation 12.4.1 basic operation of 10-bit a/d converter <1> select a channel for a/d conversion, using analog input channel specification register 0 (ads0). <2> the voltage supplied to the selected analog input channel is sampled using the sample and hold circuit. <3> after sampling continues for a certain period of time, the sample and hold circuit is put on hold to keep the input analog voltage until a/d conversion is completed. <4> bit 9 of the successive approximation a/d conversion register (sar) is set. the series resistor string voltage tap at the tap selector is set to half of av dd . <5> the series resistor string tap voltage is compared with the analog input voltage using the voltage comparator. if the analog input voltage is higher than half of av dd , the msb of the sar is left set. if it is lower than half of av dd , the msb is reset. <6> bit 8 of the sar is set automatically, and comparison shifts to the next stage. the next voltage tap of the series resistor string is selected according to bit 9, which reflects the previous comparison result, as follows: ? bit 9 = 1: three quarters of av dd ? bit 9 = 0: one quarter of av dd the tap voltage is compared with the analog input voltage. bit 8 is set or reset according to the result of comparison. ? analog input voltage 3 tap voltage: bit 8 = 1 ? analog input voltage < tap voltage: bit 8 = 0 <7> comparison is repeated until bit 0 of the sar is reached. <8> when comparison is completed for all of the 10 bits, a significant digital result is left in the sar. this value is sent to and latched in a/d conversion result register 0 (adcr0). at the same time, it is possible to generate an a/d conversion end interrupt request (intad0). cautions 1. the a/d conversion value immediately after starting the a/d conversion operation may be undefined. 2. when in standby mode, the a/d converter stops operation. .com .com .com .com 4 .com u datasheet
chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) users manual u14643ej1v0um00 155 figure 12-4. basic operation of 10-bit a/d converter a/d conversion continues until bit 7 (adcs0) of a/d converter mode register 0 (adm0) is reset (0) by software. if an attempt is made to write to adm0 or analog input channel specification register 0 (ads0) during a/d conversion, the ongoing a/d conversion is canceled. in this case, a/d conversion is restarted from the beginning, if adcs0 is set (1). reset input makes a/d conversion result register 0 (adcr0) undefined. 12.4.2 input voltage and conversion result the relationships between the analog input voltage at the analog input pins (ani0 to ani3) and the a/d conversion result (a/d conversion result register 0 (adcr0)) are represented by: adcr0 = int ( 1,024 + 0.5) or (adcr0 C 0.5) v in < (adcr0 + 0.5) int( ): function that returns the integer part of a parenthesized value v in : analog input voltage av dd : a/d converter supply voltage adcr0: value in a/d conversion result register 0 (adcr0) figure 12-5 shows the relationships between the analog input voltage and the a/d conversion result. av dd 1,024 v in av dd av dd 1,024 conversion time sampling time sampling a/d conversion undefined conversion result conversion result a/d converter operation sar adcr0 intad0 .com .com .com .com 4 .com u datasheet
chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) users manual u14643ej1v0um00 156 figure 12-5. relationships between analog input voltage and a/d conversion result 1,023 1,022 1,021 3 2 1 0 a/d conversion result (adcr0) 1 2,048 1 1,024 3 2,048 2 1,024 5 2,048 3 1,024 2,043 2,048 1,022 1,024 2,045 2,048 1,023 1,024 2,047 2,048 1 input voltage/av dd .com .com .com .com 4 .com u datasheet
chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) users manual u14643ej1v0um00 157 12.4.3 operation mode of 10-bit a/d converter the 10-bit a/d converter is initially in the select mode. in this mode, analog input channel specification register 0 (ads0) is used to select an analog input channel from ani0 to ani3 for a/d conversion. a/d conversion can be started only by software, that is, by setting a/d converter mode register 0 (adm0). the a/d conversion result is saved to a/d conversion result register 0 (adcr0). at the same time, an interrupt request signal (intad0) is generated. ? software-started a/d conversion setting bit 7 (adcs0) of a/d converter mode register 0 (adm0) triggers a/d conversion for a voltage applied to the analog input pin specified in analog input channel specification register 0 (ads0). upon completion of a/d conversion, the conversion result is saved to a/d conversion result register 0 (adcr0). at the same, an interrupt request signal (intad0) is generated. once a/d conversion is activated, and completed, another session of a/d conversion is started. a/d conversion is repeated until new data is written to the adm0. if data where adcs0 is 1 is written to adm0 again during a/d conversion, the ongoing session of a/d conversion is discontinued, and a new session of a/d conversion begins for the new data. if data where adcs0 is 0 is written to adm0 again during a/d conversion, a/d conversion is completely stopped. figure 12-6. software-started a/d conversion remarks 1. n = 0, 1, 2, 3 2. m = 0, 1, 2, 3 rewriting adm0 adcs0 = 1 rewriting adm0 adcs0 = 1 adcs0 = 0 a/d conversion adcr0 intad0 anin anin anin anim anim stop anin anin anim conversion is discontinued; no conversion result is preserved. .com .com .com .com 4 .com u datasheet
chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) users manual u14643ej1v0um00 158 12.5 cautions related to 10-bit a/d converter (1) current consumption in the standby mode when the a/d converter enters the standby mode, it stops its operation. stopping conversion (bit 7 (adcs0) of a/d converter mode register 0 (adm0) = 0) can reduce the current consumption. figure 12-7 shows how to reduce the current consumption in the standby mode. figure 12-7. how to reduce current consumption in standby mode (2) input range for the ani0 to ani3 pins be sure to keep the input voltage at ani0 to ani3 within its rating. if a voltage not lower than av dd or not higher than av ss (even within the absolute maximum rating) is input a conversion channel, the conversion output of the channel becomes undefined. it may affect the conversion output of the other channels. (3) conflict <1> conflict between writing to a/d conversion result register 0 (adcr0) at the end of conversion and reading from adcr0 reading from adcr0 takes precedence. after reading, the new conversion result is written to adcr0. <2> conflict between writing to adcr0 at the end of conversion and writing to a/d converter mode register 0 (adm0) or analog input channel specification register 0 (ads0) writing to adm0 or ads0 takes precedence. a request to write to adcr0 is ignored. no conversion end interrupt request signal (intad0) is generated. av dd av ss p-ch series resistor string adcs0 .com .com .com .com 4 .com u datasheet
chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) users manual u14643ej1v0um00 159 (4) conversion results immediately following start of a/d conversion the first a/d conversion value immediately following the start of a/d converter operation may be undefined. be sure to poll the a/d conversion end interrupt request (intad0) and perform processing such as annulling the first conversion result. (5) timing that makes the a/d conversion result undefined if the timing of the end of a/d conversion and the timing of the stop of operation of the a/c converter conflict, the a/d conversion value may be undefined. because of this, be sure to read out the a/d conversion result while the a/d converter is in operation. furthermore, when reading out an a/d conversion result after a/d converter operation has stopped, be sure to have done so by the time the next conversion result is complete. the conversion result readout timing is shown in figures 12-8 and 12-9. figure 12-8. conversion result readout timing (when conversion result is undefined value) figure 12-9. conversion result readout timing (when conversion result is normal value) a/d conversion end a/d conversion end normal conversion result undefined value normal conversion result read out undefined value read out a/d operation stopped adcr0 intad0 adcs0 normal conversion result a/d conversion end normal conversion result read out a/d operation stopped adcr0 intad0 adcs0 .com .com .com .com 4 .com u datasheet
chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) users manual u14643ej1v0um00 160 (6) noise prevention to maintain a resolution of 10 bits, watch for noise to the av dd and ani0 to ani3 pins. the higher the output impedance of the analog input source is, the larger the effect by noise is. to reduce noise, attach an external capacitor to the relevant pins as shown in figure 12-10. figure 12-10. analog input pin treatment (7) ani0 to ani3 the analog input pins (ani0 to ani3) are alternate-function pins. they are used also as port pins (p60 to p63). if any of ani0 to ani3 has been selected for a/d conversion, do not execute input instructions for the ports; otherwise, the conversion resolution may become lower. if a digital pulse is applied to a pin adjacent to the analog input pins during a/d conversion, coupling noise may occur which prevents an a/d conversion result from being attained as expected. avoid applying a digital pulse to pins adjacent to the analog input pins during a/d conversion. (8) interrupt request flag (adif0) changing content of the a/d converter mode register 0 (adm0) does not clear the interrupt request flag (adif0). if the analog input pins are changed during a/d conversion, therefore, the conversion result and the conversion end interrupt request flag may reflect the previous analog input immediately before writing to adm0 occurs. in this case, adif0 may appear to be set if it is read-accessed immediately after adm0 is write-accessed, even when a/d conversion has not been completed for the new analog input. in addition, when a/d conversion is restarted, adif0 must be cleared beforehand. c = 100 to 1000 pf if noise not lower than av dd or not higher than av ss is likely to come to the av dd pin, clamp the voltage at the pin by attaching a diode with a small v f (0.3 v or lower). av ss v ss av dd v dd .com .com .com .com 4 .com u datasheet
chapter 12 10-bit a/d converter ( m pd789114a, 789134a subseries) users manual u14643ej1v0um00 161 figure 12-11. a/d conversion end interrupt request generation timing remarks 1. n = 0, 1, 2, 3 2. m = 0, 1, 2, 3 (9) av dd pin the av dd pin is used to supply power to the analog circuit. it is also used to supply power to the ani0 to ani3 input circuit. therefore, if the application is designed to be changed to backup power, the av dd pin must be supplied with the same voltage level as for the v dd pin, as shown in figure 12-10. figure 12-12. av dd pin treatment (10) input impedance of the av dd pin a series resistor string of several 10 k w is connected across the av dd and av ss pins. therefore, if the output impedance of the reference voltage source is high, this high impedance is eventually connected in parallel with the series resistor string across the av dd and av ss pins, leading to a higher reference voltage error. rewriting to adm0 (to begin conversion for anin) a/d conversion adcr0 intad0 anin anin anim anin anin anim anim anim rewriting to adm0 (to begin conversion for anim) adif0 has been set, but conversion for anim has not been completed. main power source backup capacitor v dd av dd v ss av ss .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 162 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 163 chapter 13 serial interface 20 13.1 functions of serial interface 20 serial interface 20 has the following three modes. ? operation stop mode ? asynchronous serial interface (uart) mode ? 3-wire serial i/o mode (1) operation stop mode this mode is used when serial transfer is not performed. power consumption is minimized in this mode. (2) asynchronous serial interface (uart) mode this mode is used to send and receive the one byte of data that follows a start bit. it supports full-duplex communication. serial interface channel 0 contains a dedicated uart baud rate generator, enabling communication over a wide range of baud rates. it is also possible to define baud rates by dividing the frequency of the input clock pulse at the asck20 pin. it is recommended that ceramic/crystal oscillation be used for the system clock in the uart mode. because the frequency deviation is large in rc oscillation, if an internal clock is selected as the source clock for the baud rate generator, there may be problems in send/receive operations. (3) 3-wire serial i/o mode (switchable between msb-first and lsb-first transmission) this mode is used to transmit 8-bit data, using three lines: a serial clock (sck20) line and two serial data lines (si20 and so20). as it supports simultaneous transmission and reception, 3-wire serial i/o mode requires less processing time for data transmission than asynchronous serial interface mode. because, in 3-wire serial i/o mode, it is possible to select whether 8-bit data transmission begins with the msb or lsb, channel 0 can be connected to any device regardless of whether that device is designed for msb- first or lsb-first transmission. 3-wire serial i/o mode is useful for connecting peripheral i/o circuits and display controllers having conventional clock synchronous serial interfaces, such as those of the 75xl, 78k, and 17k series devices. 13.2 serial interface 20 configuration serial interface 20 consists of the following hardware. table 13-1. serial interface 20 configuration item configuration register transmit shift register 20 (txs20) receive shift register 20 (rxs20) receive buffer register 20 (rxb20) control register serial operating mode register 20 (csim20) asynchronous serial interface mode register 20 (asim20) asynchronous serial interface status register 20 (asis20) baud rate generator control register 20 (brgc20) .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 164 figure 13-1. serial interface 20 block diagram note see figure 13-2 for the configuration of the baud rate generator. internal bus receive buffer register 20 (rxb20) switching of the first bit asynchronous serial interface status register 20 (asis20) (asim20) serial operation mode register 20 (csim20) receive shift register 20 (rxs20) csie20 sse20 dap20 dir20 csck20 ckp20 pe20 fe20 ove20 txe20 rxe20 ps201 ps200 cl20 sl20 asynchronous serial interface mode register 20 transmit shift register 20 (txs20) transmit shift clock selector csie20 dap20 data phase control reception shift clock si20/p22/ rxd20 so20/p21/ txd20 4 parity operation stop bit addition reception data counter parity operation stop bit addition transmission data counter sl20, cl20, ps200, ps201 reception enabled reception clock detection clock start bit detection port mode register (pm21) csie20 csck20 sck20/p20/ asck20 ss20/p23/ cpt20/intp0 clock phase control reception detected internal clock output external clock input transmission and reception clock control baud rate generator note 4 tps203 tps202 tps201 tps200 csie20 csck20 f x /2 to f x /2 8 baud rate generator control register 20 (brgc20) intst20 intsr20/intcsi20 internal bus .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 165 figure 13-2. baud rate generator block diagram reception detection clock transmission shift clock reception shift clock reception detection txe20 rxe20 csie20 selector selector selector 1/2 1/2 transmission clock counter reception clock counter 4 f x /2 f x /2 3 f x /2 4 f x /2 5 f x /2 6 f x /2 7 f x /2 8 f x /2 2 sck20/asck20/p20 tps203 tps202 tps201 tps200 baud rate generator control register 20 (brgc20) internal bus .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 166 (1) transmit shift register 20 (txs20) txs20 is a register in which transmission data is prepared. the transmission data is output from txs20 bit- serially. when the data length is seven bits, bits 0 to 6 of the data in txs20 will be transmission data. writing data to txs20 triggers transmission. txs20 can be written with an 8-bit memory manipulation instruction, but cannot be read. reset input sets txs20 to ffh. caution do not write to txs20 during transmission. txs20 and receive buffer register 20 (rxb20) are mapped at the same address, so that any attempt to read from txs20 results in a value being read from rxb20. (2) receive shift register 20 (rxs20) rxs20 is a register in which serial data, received at the rxd20 pin, is converted to parallel data. once one entire byte has been received, rxs20 transfers the reception data to receive buffer register 20 (rxb20). rxs20 cannot be manipulated directly by a program. (3) receive buffer register 20 (rxb20) rxb20 holds receive data. new receive data is transferred from receive shift register 0 (rxs20) per 1 byte of data received. when the data length is specified as seven bits, the receive data is sent to bits 0 to 6 of rxb20, in which the msb is always fixed to 0. rxb20 can be read with an 8-bit memory manipulation instruction, but cannot be written to. reset input makes rxb20 undefined. caution rxb20 and transmit shift register 20 (txs20) are mapped at the same address, so that any attempt to write to rxb20 results in a value being written to txs20. (4) transmission control circuit the transmission control circuit controls transmission. for example, it adds start, parity, and stop bits to the data in transmit shift register 20 (txs20), according to the setting of asynchronous serial interface mode register 20 (asim20). (5) reception control circuit the reception control circuit controls reception according to the setting of asynchronous serial interface mode register 20 (asim20). it also checks for errors, such as parity errors, during reception. if an error is detected, asynchronous serial interface status register 20 (asis20) is set according to the status of the error. .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 167 13.3 serial interface 20 control registers serial interface 20 is controlled by the following four registers. ? serial operating mode register 20 (csim20) ? asynchronous serial interface mode register 20 (asim20) ? asynchronous serial interface status register 20 (asis20) ? baud rate generator control register 20 (brgc20) (1) serial operating mode register 20 (csim20) csim20 is used to make the settings related to 3-wire serial i/o mode. csim20 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears csim20 to 00h. figure 13-3. serial operating mode register 20 format cautions 1. bits 4 and 5 must be fixed to 0. 2. csim20 must be cleared to 00h, if uart mode is selected. csie20 0 1 3-wire serial i/o mode operation control csie20 sse20 00 dap20 dir20 csck20 ckp20 csim20 symbol address after reset r/w ff72h 00h r/w <7>6543210 operation disabled operation enabled dir20 0 1 first-bit specification msb lsb csck20 0 1 3-wire serial i/o mode clock selection external clock pulse input to the sck20 pin. output of the dedicated baud rate generator sse20 0 1 not used used dap20 0 1 3-wire serial i/o mode data phase selection outputs at the falling edge of sck20. outputs at the rising edge of sck20. ss20-pin selection function of the ss20/p23 pin port function 0 1 communication status communication enabled communication enabled communication disabled ckp20 0 1 3-wire serial i/o mode clock phase selection clock is low active, and sck20 is at high level in the idle state clock is high active, and sck20 is at low level in the idle state .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 168 (2) asynchronous serial interface mode register 20 (asim20) asim20 is used to make the settings related to asynchronous serial interface mode. asim20 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears asim20 to 00h. figure 13-4. asynchronous serial interface mode register 20 format cautions 1. bits 0 and 1 must be fixed to 0. 2. if 3-wire serial i/o mode is selected, asim20 must be cleared to 00h. 3. switch operating modes after halting a serial transmit/receive operation. txe20 0 1 transmit operation control txe20 rxe20 ps201 ps200 cl20 sl20 00 asim20 symbol address after reset r/w ff70h 00h r/w <7><6>543210 send operation stop send operation enable rxe20 0 1 receive operation control receive operation stop receive operation enable ps201 0 0 1 1 parity bit specification ps200 0 1 0 1 no parity always add 0 parity at transmission. parity check is not performed at reception (no parity error is generated). odd parity even parity cl20 0 1 transmit data character length specification 7 bits 8 bits sl20 0 1 transmit data stop bit length 1 bit 2 bits .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 169 table 13-2. serial interface 20 operating mode settings (1) operation stopped mode asim20 csim20 pm22 p21 pm21 p21 pm20 p20 first shift p22/si20/rxd20 p21/so20/txd20 p20/sck20/ txe20 rxe20 csie20 dir20 csck20 bit clock pin function pin function asck20 pin function 000 note 1 note 1 note 1 note 1 note 1 note 1 p22 p21 p20 other than above setting prohibited (2) 3-wire serial i/o mode asim20 csim20 pm22 p22 pm21 p21 pm20 p20 first shift p22/si20/rxd20 p21/so20/txd20 p20/sck20/ txe20 rxe20 csie20 dir20 csck20 bit clock pin function pin function asck20 pin function 00100 note 1 note 2 01 1 msb externa l si20 note 2 sck20 sck20 clock (cmos output) input 101 internal sck20 clock output 110 1 lsb externa l sck20 clock input 101 internal sck20 clock output other than above setting prohibited (3) asynchronous serial interface mode asim20 csim20 pm22 p22 pm21 p21 pm20 p20 first shift p22/si20/rxd20 p21/so20/txd20 p20/sck20/ txe20 rxe20 csie20 dir20 csck20 bit clock pin function pin function asck20 pin function 10000 note 1 note 1 01 1 lsb externa l p22 txd20 asck20 clock (cmos output) input note 1 note 1 internal p20 clock 010001 note 1 note 1 1 externa l rd20 p21 asck20 clock input note 1 note 1 internal p20 clock 110001 01 1 externa l txd20 asck20 clock (cmos output) input note 1 note 1 internal p20 clock other than above setting prohibited notes 1. these pins can be used for port functions. 2. when only transmission is used, these pins can be used as p22 (cmos input/output). remark : dont care. .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 170 (3) asynchronous serial interface status register 20 (asis20) asis20 is used to display the type of a reception error, if it occurs while asynchronous serial interface mode is set. asis20 is read with a 1-bit or 8-bit memory manipulation instruction. the contents of asis20 are undefined in 3-wire serial i/o mode. reset input clears asis20 to 00h. figure 13-5. asynchronous serial interface status register 20 format notes 1. even when the stop bit length is set to 2 bits by setting bit 2 (sl20) of asynchronous serial interface mode register 20 (asim20), the stop bit detection in the case of reception is performed with 1 bit. 2. be sure to read receive buffer register 20 (rxb20) when an overrun error occurs. if not, every time the data is received an overrun error is generated. pe20 0 1 parity error flag 00000 pe20 fe20 ove20 asis20 symbol address after reset r/w ff71h 00h r 76543210 no parity error has occurred. a parity error has occurred (parity mismatch in transmission data). fe20 0 1 flaming error flag no framing error has occurred. a framing error has occurred (no stop bit detected). note 1 ove20 0 1 overrun error flag no overrun error has occurred. an overrun error has occurred. note 2 (before data was read from the reception buffer register, the subsequent reception sequence was completed.) .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 171 (4) baud rate generator control register 20 (brgc20) brgc20 is used to specify the serial clock for serial interface. brgc20 is set with an 8-bit memory manipulation instruction. reset input clears brgc20 to 00h. figure 13-6. baud rate generator control register 20 format note an external clock can only be used in uart mode. cautions 1. when writing to brgc20 is performed during a communication operation, the output of baud rate generator is disrupted and communications cannot be performed normally. be sure not to write to brgc20 during communication operations. 2. be sure not to select n = 1 during operation at f x = 5.0 mhz because n = 1 exceeds the baud rate limit. 3. when the external input clock is selected, set port mode register 2 (pm2) in input mode. remarks 1. f x : system clock oscillation frequency (ceramic/crystal oscillation) 2. n: value specified in tps200 to tps203 (1 n 8) 3. values in parentheses apply to operation with f x = 5.0 mhz. tps203 0 0 0 0 0 0 0 0 1 3-bit counter source clock selection tps203 tps202 tps201 tps200 0000 brgc20 symbol address after reset r/w ff73h 00h r/w 76543210 tps202 0 0 0 0 1 1 1 1 0 f x /2 f x /2 2 f x /2 3 f x /2 4 f x /2 5 f x /2 6 f x /2 7 f x /2 8 external clock pulse input at the asck20 pin note setting prohibited (2.5 mhz) (1.25 mhz) (625 khz) (313 khz) (156 khz) (78.1 khz) (39.1 khz) (19.5 khz) other than above tps201 0 0 1 1 0 0 1 1 0 tps200 0 1 0 1 0 1 0 1 0 n 1 2 3 4 5 6 7 8 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 172 the baud rate transmit/receive clock to be generated is either a signal scaled from the system clock, or a signal scaled from the clock input from the asck20 pin. (a) generation of baud rate transmit/receive clock by means of system clock the transmit/receive clock is generated by scaling the system clock. the baud rate generated from the system clock is estimated by using the following expression. [baud rate] = [hz] f x : system clock oscillation frequency (ceramic/crystal oscillation) n: values in figure 13-6 specified by the setting in tps200 to tps203 (2 n 8) table 13-3. example of relationship between system clock and baud rate baud rate (bps) n brgc20 set value error (%) f x = 5.0 mhz f x = 4.9152 mhz 1,200 8 70h 1.73 0 2,400 7 60h 4,800 6 50h 9,600 5 40h 19,200 4 30h 38,400 3 20h 76,800 2 10h f x 2 n + 1 8 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 173 (b) generation of baud rate transmit/receive clock by means of external clock from asck20 pin the transmit/receive clock is generated by scaling the clock input from the asck20 pin. the baud rate generated from the clock input from the asck20 pin is estimated by using the following expression. [baud rate] = [hz] f asck : frequency of clock pulse received at the asck20 pin table 13-4. relationship between asck20 pin input frequency and baud rate (when brgc20 is set to 80h) baud rate (bps) asck20 pin input frequency (khz) 75 1.2 150 2.4 300 4.8 600 9.6 1,200 19.2 2,400 38.4 4,800 76.8 9,600 153.6 19,200 307.2 31,250 500.0 38,400 614.4 f asck 16 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 174 13.4 serial interface 20 operation serial interface 20 provides the following three types of modes. ? operation stop mode ? asynchronous serial interface (uart) mode ? 3-wire serial i/o mode 13.4.1 operation stop mode in the operation stop mode, serial transfer is not executed, therefore, the power consumption can be reduced. the p20/sck20/asck20, p21/so20/txd20, and p22/si20/rxd20 pins can be used as normal i/o ports. (1) register setting operation stop mode is set by serial operating mode register 20 (csim20) and asynchronous serial interface mode register 20 (asim20). (a) serial operation mode register 20 (csim20) csim20 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears csim20 to 00h. caution be sure to set bits 4 and 5 to 0. csie20 0 1 operation control in 3-wire serial i/o mode csie20 sse20 0 0 dap20 dir20 csck20 ckp20 csim20 symbol address after reset r/w ff72h 00h r/w <7>6543210 operation disable operation enable .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 175 (b) asynchronous serial interface mode register 20 (asim20) asim20 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears asim20 to 00h. caution be sure to set bits 0 and 1 to 0. txe20 0 1 transmit operation control txe20 rxe20 ps201 ps200 cl20 sl20 0 0 asim20 symbol address after reset r/w ff70h 00h r/w <7><6>543210 transmit operation stop transmit operation enable receive operation stop receive operation enable rxe20 0 1 receive operation control .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 176 13.4.2 asynchronous serial interface (uart) mode in this mode, the one-byte data following the start bit is transmitted/received and thus full-duplex communication is possible. this device incorporates a uart-dedicated baud rate generator that enables communication at the desired transfer rate from many options. in addition, the baud rate can also be defined by dividing the input clock to the asck pin. the uart-dedicated baud rate generator also can output the 31.25-kbps baud rate that complies with the midi standard. it is recommended that the ceramic/crystal oscillation be used for the system clock in the uart mode. because the frequency deviation is large in rc oscillation, if an internal clock is selected as the source clock for the baud rate generator, there may be problems in send/receive operations. (1) register setting the uart mode is set by serial operating mode register 20 (csim20), asynchronous serial interface mode register 20 (asim20), asynchronous serial interface status register 20 (asis20), and baud rate generator control register 20 (brgc20). .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 177 (a) serial operating mode register 20 (csim20) csim20 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears csim20 to 00h. set 00h to csim20 when uart mode is selected. caution bits 4 and 5 must be fixed to 0. csie20 0 1 3-wire serial i/o mode operation control csie20 sse20 00 dap20 dir20 csck20 ckp20 csim20 symbol address after reset r/w ff72h 00h r/w <7>6543210 operation disabled operation enabled dir20 0 1 first-bit specification msb lsb csck20 0 1 3-wire serial i/o mode clock selection external clock pulse input to the sck20 pin. output of the dedicated baud rate generator sse20 0 1 not used used dap20 0 1 3-wire serial i/o mode data phase selection outputs at the falling edge of sck20. outputs at the rising edge of sck20. ss20-pin selection function of the ss20/p23 pin port function 0 1 communication status communication enabled communication enabled communication disabled ckp20 0 1 3-wire serial i/o mode clock phase selection clock is low active, and sck20 is high level in the idle state clock is high active, and sck20 is low level in the idle state .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 178 (b) asynchronous serial interface mode register 20 (asim20) asim20 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears asim20 to 00h. cautions 1. be sure to set bits 0 and 1 to 0. 2. switch operating modes after halting the serial transmit/receive operation. txe20 0 1 transmit operation control txe20 rxe20 ps201 ps200 cl20 sl20 0 0 asim20 symbol address after reset r/w ff70h 00h r/w <7><6>543210 transmit operation stop transmit operation enable receive operation stop receive operation enable rxe20 0 1 0 1 0 0 0 1 0 1 1 1 no parity always add 0 parity at transmission. parity check is not performed at reception (no parity error is generated). odd parity even parity receive operation control ps201 parity bit specification ps200 cl20 0 1 sl20 character length specification 7 bits 8 bits 1 bit 2 bits transmit data stop bit length specification .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 179 (c) asynchronous serial interface status register 20 (asis20) asis20 is read with a 1-bit or 8-bit memory manipulation instruction. reset input clears asis20 to 00h. notes 1. even when the stop bit length is set to 2 bits by setting bit 2 (sl20) of asynchronous serial interface mode register 20 (asim20), the stop bit detection in the case of reception is performed with 1 bit. 2. be sure to read receive buffer register 20 (rxb20) when an overrun error occurs. if not, every time the data is received an overrun error is generated. pe20 0 1 parity error flag 00000 pe20 fe20 ove20 asis20 symbol address after reset r/w ff71h 00h r 76543210 parity error not generated parity error generated (when the parity of transmit data does not match.) framing error not generated framing error generated (when stop bit is not detected.) note 1 overrun error not generated overrun error generated note 2 (when the next receive operation is completed before the data is read from the receive buffer register.) fe20 0 1 0 1 flaming error flag overrun error flag ove20 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 180 (d) baud rate generator control register 20 (brgc20) brgc20 is set with an 8-bit memory manipulation instruction. reset input clears brgc20 to 00h. cautions 1. when writing to brgc20 is performed during a communication operation, the output of baud rate generator is disrupted and communications cannot be performed normally. be sure not to write to brgc20 during communication operation. 2. be sure not to select n = 1 during an operation at f x = 5.0 mhz because n = 1 exceeds the baud rate limit. 3. when the external input clock is selected, set port mode register 2 (pm2) to input mode. remarks 1. f x : system clock oscillation frequency (ceramic/crystal oscillation) 2. n: values specified by the setting in tps200 to tps203 (1 n 8) 3. values in parentheses apply to operation with f x = 5.0 mhz. tps203 0 0 0 0 0 0 0 0 1 tps203 tps202 tps201 tps200 0000 brgc20 r/w ff73h 00h r/w 76543210 tps202 0 0 0 0 1 1 1 1 0 f x /2 f x /2 2 f x /2 3 f x /2 4 f x /2 5 f x /2 6 f x /2 7 f x /2 8 (2.5 mhz) (1.25 mhz) (625 khz) (313 khz) (156 khz) (78.1 khz) (39.1 khz) (19.5 khz) tps201 0 0 1 1 0 0 1 1 0 tps200 0 1 0 1 0 1 0 1 0 n 1 2 3 4 5 6 7 8 setting prohibited symbol address after reset 3-bit counter source clock selection input clock from external to asck20 pin. other than above .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 181 the baud rate transmit/receive clock to be generated is either a signal scaled from the system clock, or a signal scaled from the clock input from the asck20 pin. (i) generation of baud rate transmit/receive clock by means of system clock the transmit/receive clock is generated by scaling the system clock. the baud rate generated from the system clock is estimated by using the following expression. [baud rate] = [hz] f x : system clock oscillation frequency (ceramic/crystal oscillation) n: values in the above table specified by the setting in tps200 to tps203 (2 n 8) table 13-5. example of relationship between system clock and baud rate baud rate (bps) n brgc20 set value error (%) f x = 5.0 mhz f x = 4.9152 mhz 1,200 8 70h 1.73 0 2,400 7 60h 4,800 6 50h 9,600 5 40h 19,200 4 30h 38,400 3 20h 76,800 2 10h f x 2 n + 1 8 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 182 f asck 16 (ii) generation of baud rate transmit/receive clock by means of external clock from asck20 pin the transmit/receive clock is generated by scaling the clock input from the asck20 pin. the baud rate generated from the clock input from the asck20 pin is estimated by using the following expression. [baud rate] = [hz] f asck : frequency of clock input to asck20 pin. table 13-6. relationship between asck20 pin input frequency and baud rate (when brgc20 is set to 80h) baud rate (bps) asck20 pin input frequency (khz) 75 1.2 150 2.4 300 4.8 600 9.6 1,200 19.2 2,400 38.4 4,800 76.8 9,600 153.6 19,200 307.2 31,250 500.0 38,400 614.4 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 183 (2) communication operation (a) data format the transmit/receive data format is as shown in figure 13-7. one data frame consists of a start bit, character bits, parity bit and stop bit(s). the specification of character bit length, parity selection, and specification of stop bit length for each data frame is carried out using asynchronous serial interface mode register 20 (asim20). figure 13-7. asynchronous serial interface transmit/receive data format ? start bits .................. 1 bit ? character bits .......... 7 bits/8 bits ? parity bits ................. even parity/odd parity/0 parity/no parity ? stop bits ................... 1 bit/2 bits when 7 bits are selected as the number of character bits, only the lower 7 bits (bits 0 to 6) are valid; in transmission the most significant bit (bit 7) is ignored, and in reception the most significant bit (bit 7) is always 0. the serial transfer rate is selected by means of asim20 and baud rate generator control register 20 (brgc20). if a serial data receive error is generated, the receive error contents can be determined by reading the status of asynchronous serial interface status register 20 (asis20). d0 d1 d2 d3 d4 d5 d6 d7 parity bit stop bit start bit one data frame .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 184 (b) parity types and operation the parity bit is used to detect a bit error in the communication data. normally, the same kind of parity bit is used on the transmitting side and the receiving side. with even parity and odd parity, a one-bit (odd number) error can be detected. with 0 parity and no parity, an error cannot be detected. (i) even parity ? at transmission the transmission operation is controlled so that the number of bits with a value of 1 in the transmit data including parity bit may be even. the parity bit value should be as follows. the number of bits with a value of 1 is an odd number in transmit data: 1 the number of bits with a value of 1 is an even number in transmit data: 0 ? at reception the number of bits with a value of 1 in the receive data including parity bit is counted, and if the number is odd, a parity error is generated. (ii) odd parity ? at transmission conversely to even parity, the transmission operation is controlled so that the number of bits with a value of 1 in the transmit data including parity bit may be odd. the parity bit value should be as follows. the number of bits with a value of 1 is an odd number in transmit data: 0 the number of bits with a value of 1 is an even number in transmit data: 1 ? at reception the number of bits with a value of 1 in the receive data including parity bit is counted, and if the number is even, a parity error is generated. (iii) 0 parity when transmitting, the parity bit is set to 0 irrespective of the transmit data. at reception, a parity bit check is not performed. therefore, a parity error is not generated, irrespective of whether the parity bit is set to 0 or 1. (iv) no parity a parity bit is not added to the transmit data. at reception, data is received assuming that there is no parity bit. since there is no parity bit, a parity error is not generated. .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 185 (c) transmission a transmit operation is started by writing transmit data to transmit shift register 20 (txs20). the start bit, parity bit and stop bit are added automatically. when the transmit operation starts, the data in txs20 is shifted out, and when txs20 is empty, a transmission completion interrupt (intst20) is generated. figure 13-8. asynchronous serial interface transmission completion interrupt timing (a) stop bit length: 1 (b) stop bit length: 2 caution do not rewrite asynchronous serial interface mode register 20 (asim20) during a transmit operation. if asim20 register is rewritten during transmission, subsequent transmission may not be performed (the normal state is restored by reset input). it is possible to determine whether transmission is in progress by software by using a transmission completion interrupt (intst20) or the interrupt request flag (stif20) set by intst20. stop parity d7 d6 d2 d1 d0 start txd20 (output) intst20 stop parity d7 d6 d2 d1 d0 start txd20 (output) intst20 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 186 (d) reception when bit 6 (rxe20) of asynchronous serial interface mode register 20 (asim20) is set (1), a receive operation is enabled and sampling of the rxd20 pin input is performed. rxd20 pin input sampling is performed using the serial clock specified by asim20. when the rxd20 pin input becomes low, the 3-bit counter starts counting, and when half the time determined by the specified baud rate has passed, the data sampling start timing signal is output. if the rxd20 pin input sampled again as a result of this start timing signal is low, it is identified as a start bit, the 3-bit counter is initialized and starts counting, and data sampling is performed. when character data, a parity bit and one stop bit are detected after the start bit, reception of one frame of data ends. when one frame of data has been received, the receive data in the shift register is transferred to receive buffer register 20 (rxb20), and a reception completion interrupt (intsr20) is generated. if an error is generated, the receive data in which the error was generated is still transferred to rxb20, and intsr20 is generated. if the rxe20 bit is reset (0) during the receive operation, the receive operation is stopped immediately. in this case, the contents of rxb20 and asynchronous serial interface status register 20 (asis20) are not changed, and intsr20 is not generated. figure 13-9. asynchronous serial interface reception completion interrupt timing caution be sure to read receive buffer register 20 (rxb20) even if a receive error occurs. if rxb20 is not read, an overrun error will be generated when the next data is received, and the receive error state will continue indefinitely. stop parity d7 d6 d2 d1 d0 start rxd20 (input) intsr20 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 187 (e) receive errors the following three errors may occur during a receive operation: a parity error, framing error, or overrun error. the data reception result error flag is set in asynchronous serial interface status register 20 (asis20). receive error causes are shown in table 13-7. it is possible to determine what kind of error was generated during reception by reading the contents of asis20 in the reception error interrupt servicing (see figures 13-9 and 13-10). the contents of asis20 are reset (0) by reading receive buffer register 20 (rxb20) or receiving the next data (if there is an error in the next data, the corresponding error flag is set). table 13-7. receive error causes receive errors cause parity error transmission-time parity specification and reception data parity do not match framing error stop bit not detected overrun error reception of next data is completed before data is read from receive register buffer figure 13-10. receive error timing (a) parity error generated (b) framing error or overrun error generated cautions 1. the contents of the asis20 register are reset (0) by reading receive buffer register 20 (rxb20) or receiving the next data. to ascertain the error contents, read asis20 before reading rxb20. 2. be sure to read receive buffer register 20 (rxb20) even if a receive error is generated. if rxb20 is not read, an overrun error will be generated when the next data is received, and the receive error state will continue indefinitely. stop parity d7 d6 d2 d1 d0 start rxd20 (input) intsr20 stop parity d7 d6 d2 d1 d0 start rxd20 (input) intsr20 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 188 (3) uart mode cautions (a) when bit 7 (txe20) of asynchronous serial interface mode register 20 (asim20) is cleared during transmission, be sure to set transmit shift register 20 (txs20) to ffh, then set txe20 to 1 before executing the next transmission. (b) when bit 6 (rxe20) of asynchronous serial interface mode register 20 (asim20) is cleared during reception, receive buffer register 20 (rxb20) and receive completion interrupt 20 (intsr20) are as follows. when rxe20 is set to 0 at a time indicated by <1> , rxb20 holds the previous data and does not generate intsr20. when rxe20 is set to 0 at a time indicated by <2> , rxb20 renews the data and does not generate intsr20. when rxe20 is set to 0 at a time indicated by <3> , rxb20 renews the data and generates intsr20. parity rxd20 pin rxb20 intsr20 <3> <1> <2> .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 189 13.4.3 3-wire serial i/o mode the 3-wire serial i/o mode is useful for connection of peripheral i/os and display controllers, etc. that incorporate a conventional synchronous clocked serial interface, such as the 75xl series, 78k series, 17k series, etc. communication is performed using three lines: the serial clock (sck20), serial output (so20), and serial input (si20). (1) register setting 3-wire serial i/o mode settings are performed using serial operating mode register 20 (csim20), asynchronous serial interface mode register 20 (asim20), and baud rate generator control register 20 (brgc20). (a) serial operating mode register 20 (csim20) csim20 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears csim20 to 00h. caution bits 4 and 5 must be fixed to 0. csie20 0 1 3-wire serial i/o mode operation control csie20 sse20 00 dap20 dir20 csck20 ckp20 csim20 symbol address after reset r/w ff72h 00h r/w <7>6543210 operation disabled operation enabled dir20 0 1 first-bit specification msb lsb csck20 0 1 3-wire serial i/o mode clock selection external clock pulse input to the sck20 pin. output of the dedicated baud rate generator sse20 0 1 not used used dap20 0 1 3-wire serial i/o mode data phase selection outputs at the falling edge of sck20. outputs at the rising edge of sck20. ss20-pin selection function of the ss20/p23 pin port function 0 1 communication status communication enabled communication enabled communication disabled ckp20 0 1 3-wire serial i/o mode clock phase selection clock is low active, and sck20 is at high level in the idle state clock is high active, and sck20 is at low level in the idle state .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 190 (b) asynchronous serial interface mode register 20 (asim20) asim20 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears asim20 to 00h. when the 3-wire serial i/o mode is selected, 00h must be set to asim20. cautions 1. be sure to set bits 0 and 1 to 0. 2. switching operation modes must be performed after the serial transmit/receive operation is halted. txe20 0 1 transmit operation control txe20 rxe20 ps201 ps200 cl20 sl20 0 0 asim20 symbol address after reset r/w ff70h 00h r/w <7><6>543210 transmit operation stop transmit operation enable receive operation stop receive operation enable rxe20 0 1 0 1 0 0 0 1 0 1 1 1 no parity always add 0 parity at transmission. parity check is not performed at reception (no parity error is generated). odd parity even parity receive operation control ps201 parity bit specification ps200 cl20 0 1 sl20 character length specification 7 bits 8 bits 1 bit 2 bits transmit data stop bit length specification .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 191 (c) baud rate generator control register 20 (brgc20) brgc20 is set with an 8-bit memory manipulation instruction. reset input clears brgc20 to 00h. cautions 1. when writing to brgc20 is performed during a communication operation, the baud rate generator output is disrupted and communication cannot be performed normally. be sure not to write to brgc20 during communication operation. 2. be sure not to select n = 1 during an operation at f x = 5.0 mhz because n = 1 exceeds the baud rate limit. 3. when the external input clock is selected, set port mode register 2 (pm2) in input mode. remarks 1. f x : system clock oscillation frequency (ceramic/crystal oscillation) 2. n: values specified by tps200 to tps203 (1 n 8) 3. values in parentheses apply to operation with f x = 5.0 mhz. if the internal clock is used as the serial clock for the 3-wire serial i/o mode, set the tps200 to tps203 bits to set the frequency of the serial clock. to obtain the frequency to be set, use the following formula. when the serial clock is input from off-chip, setting brgc20 is not necessary. serial clock frequency = [hz] f x : system clock oscillation frequency (ceramic/crystal oscillation) n: values in the above table specified by the setting in tps200 to tps203 (1 n 8) f x 2 n + 1 tps203 0 0 0 0 0 0 0 0 tps203 tps202 tps201 tps200 0000 brgc20 r/w ff73h 00h r/w 76543210 tps202 0 0 0 0 1 1 1 1 f x /2 f x /2 2 f x /2 3 f x /2 4 f x /2 5 f x /2 6 f x /2 7 f x /2 8 (2.5 mhz) (1.25 mhz) (625 khz) (313 khz) (156 khz) (78.1 khz) (39.1 khz) (19.5 khz) tps201 0 0 1 1 0 0 1 1 tps200 0 1 0 1 0 1 0 1 n 1 2 3 4 5 6 7 8 setting prohibited symbol address after reset 3-bit counter source clock selection other than above .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 192 (2) communication operation in the 3-wire serial i/o mode, data transmission/reception is performed in 8-bit units. data is transmitted/ received bit by bit in synchronization with the serial clock. the transmit shift register (txs20/sio20) and receive shift register (rxs20) shift operations are performed in synchronization with the fall of the serial clock (sck20). then transmit data is held in the so20 latch and output from the so20 pin. also, receive data input to the si0 pin is latched in the receive buffer register (rxb20/ sio20) on the rise of sck20. at the end of an 8-bit transfer, the operation of txs20/sio20 or rxs20 stops automatically, and the interrupt request signal (intcsi20) is generated. figure 13-11. 3-wire serial i/o mode timing (1/7) (i) master operation timing (when dap20 = 0, ckp20 = 0, sse20 = 0) note the value of the last bit previously output is output. 12345678 do7 do6 do5 do4 do3 do2 do1 do0 di7 di6 di5 di4 di3 di2 di1 di0 sck20 so20 note si20 sio20 write intcsi20 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 193 figure 13-11. 3-wire serial i/o mode timing (2/7) (ii) slave operation timing (when dap20 = 0, ckp20 = 0, sse20 = 0) note the value of the last bit previously output is output. (iii) slave operation (when dap20 = 0, ckp20 = 0, sse20 = 1) notes 1. the value of the last bit previously output is output. 2. do0 is output until ss20 rises. when ss20 is high, so20 is in a high-impedance state. 12345678 di7 di6 di5 di4 di3 di2 di1 di0 do7 note 1 do6 do5 do4 do3 do2 do1 do0 note 2 sck20 si20 so20 hi-z hi-z ss20 sio20 write intcsi20 12345678 di7 di6 di5 di4 di3 di2 di1 di0 do7 do6 do5 do4 do3 do2 do1 do0 sck20 si20 note so20 sio20 write intcsi20 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 194 figure 13-11. 3-wire serial i/o mode timing (3/7) (iv) master operation (when dap20 = 0, ckp20 = 1, sse20 = 0) (v) slave operation (when dap20 = 1, ckp20 = 1, sse20 = 0) note the data of si20 is loaded at the first rising edge of sck20. make sure that the master outputs the first bit before the first rising of sck20. 12345678 do7 do6 do5 do4 do3 do2 do1 do0 di7 di6 di5 di4 di3 di2 di1 di0 sck20 so20 si20 sio20 write intcsi20 12345678 di7 di6 di5 di4 di3 di2 di1 di0 do7 do6 do5 do4 do3 do2 do1 do0 sck20 si20 so20 sio20 write intcsi20 sio20 write (master) note .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 195 figure 13-11. 3-wire serial i/o mode timing (4/7) (vi) slave operation (when dap20 = 0, ckp20 = 1, sse20 = 1) notes 1. the data of si20 is loaded at the first rising edge of sck20. make sure that the master outputs the first bit before the first rising of sck20. 2. so20 is high until ss20 rises after completion of do0 output. when ss20 is high, so20 is in a high-impedance state. (vii) master operation (when dap20 = 1, ckp20 = 0, sse20 = 0) 12345678 di7 di6 di5 di4 di3 di2 di1 di0 do7 do6 do5 do4 do3 do2 do1 note 2 sck20 si20 hi-z hi-z so20 sio20 write ss20 intcsi20 do0 sio20 write (master) note 1 12345678 do7 do6 do5 do4 do3 do2 do1 do0 di7 di6 di5 di4 di3 di2 di1 di0 sck20 so20 si20 sio20 write intcsi20 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 196 figure 13-11. 3-wire serial i/o mode timing (5/7) (viii) slave operation (when dap20 = 1, ckp20 = 0, sse20 = 0) note the data of si20 is loaded at the first falling edge of sck20. make sure that the master outputs the first bit before the first falling of sck20. (ix) slave operation (when dap20 = 1, ckp20 = 0, sse20 = 1) notes 1. the data of si20 is loaded at the first falling edge of sck20. make sure that the master outputs the first bit before the first falling of sck20. 2. so20 is high until ss20 rises after completion of do0 output. when ss20 is high, so20 is in a high-impedance state. 12345678 di7 di6 di5 di4 di3 di2 di1 di0 do7 do6 do5 do4 do3 do2 do1 do0 sck20 si20 so20 sio20 write intcsi20 sio20 write (master) note 12345678 di7 di6 di5 di4 di3 di2 di1 di0 do7 do6 do5 do4 do3 do2 do1 note 2 sck20 si20 hi-z hi-z so20 sio20 write ss20 intcsi20 do0 sio20 write (master) note 1 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 197 figure 13-11. 3-wire serial i/o mode timing (6/7) (x) master operation (when dap20 = 1, ckp20 = 1, sse20 = 0) note the value of the last bit previously output is output. (xi) slave operation (when dap20 = 1, ckp20 = 1, sse20 = 0) note the value of the last bit previously output is output. 12345678 do7 note do6 do5 doi4 do3 do2 do1 di7 di6 di5 di4 di3 di2 di1 sck20 so20 si20 sio20 write intcsi20 di0 do0 12345678 di7 di6 di5 di4 di3 di2 di1 sck20 si20 so20 sio20 write intcsi20 do7 note do6 do5 doi4 do3 do2 do1 do0 di0 .com .com .com .com 4 .com u datasheet
chapter 13 serial interface 20 users manual u14643ej1v0um00 198 figure 13-11. 3-wire serial i/o mode timing (7/7) (xii) slave operation (when dap20 = 1, ckp20 = 1, sse20 = 1) notes 1. the value of the last bit previously output is output. 2. do0 is output until ss20 rises. when ss20 is high, so20 is in a high-impedance state. (3) transfer start serial transfer is started by setting transfer data to the transmission shift register (txs20/sio20) when the following two conditions are satisfied. ? serial operation mode register 20 (csim20) bit 7 (csie20) = 1 ? internal serial clock is stopped or sck20 is a high level after 8-bit serial transfer. caution if csie20 is set to 1 after data write to txs20/sio20, transfer does not start. a termination of 8-bit transfer stops the serial transfer automatically and generates the interrupt request signal (intcsi20). 12345678 di7 di6 di5 di4 di3 di2 di1 di0 do7 do6 do5 do4 do3 do2 do1 do0 note 2 sck20 si20 note 1 so20 hi-z hi-z ss20 sio20 write intcsi20 .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 199 chapter 14 multiplier 14.1 multiplier function the multiplier has the following function: ? calculation of 8 bits 8 bits = 16 bits 14.2 multiplier configuration (1) 16-bit multiplication result storage register 0 (mul0) this register stores the 16-bit result of multiplication. this register holds the result of multiplication after 16 cpu clocks have elapsed. mul0 is set with a 16-bit memory manipulation instruction. reset input makes this register undefined. caution although this register is manipulated with a 16-bit memory manipulation instruction, it can be also manipulated with an 8-bit memory manipulation instruction. when using an 8-bit memory manipulation instruction, however, access the register by means of direct addressing. (2) multiplication data registers a and b (mra0 and mrb0) these are 8-bit multiplication data storage registers. the multiplier multiplies the values of mra0 and mrb0. mra0 and mrb0 are set with a 1-bit or 8-bit memory manipulation instructions. reset input makes these registers undefined. figure 14-1 shows the block diagram of the multiplier. .com .com .com .com 4 .com u datasheet
chapter 14 multiplier users manual u14643ej1v0um00 200 figure 14-1. block diagram of multiplier internal bus selector counter value 3 cpu clock start clear counter output 16-bit adder 16-bit multiplication result storage register 0 (master) (mul0) 16-bit multiplication result storage register 0 (slave) multiplication data register a (mra0) multiplication data register b (mrb0) internal bus 3-bit counter mulst0 reset multiplier control register 0 (mulc0) .com .com .com .com 4 .com u datasheet
chapter 14 multiplier users manual u14643ej1v0um00 201 14.3 multiplier control register the multiplier is controlled by the following register: ? multiplier control register (mulc0) mulc0 indicates the operating status of the multiplier after operation, as well as controls the multiplier. mulc0 is set with a 1-bit or 8-bit memory manipulation instruction. reset input clears this register to 00h. figure 14-2. multiplier control register 0 format caution be sure to set bits 1 to 7 to 0. mulst0 0 1 multiplier operation start control bit 0000000 mulst0 mulc0 symbol address after reset r/w ffd2h 00h r/w 76543210 stops operation after resetting counter to 0. enables operation operation stops operation in progress operating status of multiplier .com .com .com .com 4 .com u datasheet
chapter 14 multiplier users manual u14643ej1v0um00 202 14.4 multiplier operation the multiplier of the m pd789104a/114a/124a/134a subseries can execute the calculation of 8 bits 8 bits = 16 bits. figure 14-3 shows the operation timing of the multiplier where mra0 is set to aah and mrb0 is set to d3h. <1> counting is started by setting mulst0. <2> the data generated by the selector is added to the data of mul0 at each cpu clock, and the counter value is incremented by one. <3> if mulst0 is cleared when the counter value is 111b, the operation is stopped. at this time, mul0 holds the data. <4> while mulst0 is low, the counter and slave are cleared. figure 14-3. multiplier operation timing aa d3 000b 00aa 0000 001b 010b 011b 100b 101b 110b 111b 000b 0154 0000 0000 0aa0 0000 2a80 5500 00aa 00aa 01fe 01fe 01fe 0c9e 0c9e 371e 8c1e 00aa 01fe 01fe 01fe 0c9e 0c9e 371e 0000 cpu clock mra0 mrb0 mulst0 counter selector output mul0 (master) (slave) .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 203 chapter 15 interrupt functions 15.1 interrupt function types the following two types of interrupt functions are used. (1) non-maskable interrupt this interrupt is acknowledged unconditionally. it does not undergo interrupt priority control and is given top priority over all other interrupt requests. a standby release signal is generated. the non-maskable interrupt has one source of interrupt from the watchdog timer. (2) maskable interrupt these interrupts undergo mask control. if two or more interrupts with the same priority are simultaneously generated, each interrupt has a predetermined priority as shown in table 15-1. a standby release signal is generated. the maskable interrupt has three sources of external interrupts and six sources of internal interrupts. 15.2 interrupt sources and configuration there are total of 10 non-maskable and maskable interrupts in the interrupt sources (see table 15-1 ). .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 204 table 15-1. interrupt source list interrupt type priority note 1 interrupt source internal vector basic /external table configuration name trigger address type note 2 non-maskable intwdt watchdog timer overflow (watchdog timer internal 0004h (a) mode 1 selected) maskable 0 intwdt watchdog timer overflow (interval timer (b) mode selected) 1 intp0 pin input edge detection external 0006h (c) 2 intp1 0008h 3 intp2 000ah 4 intsr20 end of serial interface 20 uart reception internal 000ch (b) intcsi20 end of serial interface 20 3-wire transfer 5 intst20 end of serial interface 20 uart 000eh transmission 6 inttm80 generation of 8-bit timer/event counter 80 0010h match signal 7 inttm20 generation of 16-bit timer 20 0012h match signal 8 intad0 a/d conversion completion signal 0014h notes 1. priority is the priority applicable when two or more maskable interrupts are simultaneously generated. 0 is the highest priority and 8 is the lowest priority. 2. basic configuration types a to c correspond to a to c in figure 15-1. remark as the interrupt source of the watchdog timer (intwdt), either a non-maskable interrupt or a maskable interrupt (internal) can be selected. .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 205 figure 15-1. basic configuration of interrupt function (a) internal non-maskable interrupt (b) internal maskable interrupt (c) external maskable interrupt if: interrupt request flag ie: interrupt enable flag mk: interrupt mask flag internal bus interrupt request vector table address generator standby release signal mk if ie internal bus interrupt request vector table address generator standby release signal mk if ie internal bus external interrupt mode register (intm0) interrupt request edge detector vector table address generator standby release signal .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 206 15.3 interrupt function control registers the following four registers are used to control the interrupt functions. ? interrupt request flag registers (if0, if1) ? interrupt mask flag registers (mk0, mk1) ? external interrupt mode register (intm0) ? program status word (psw) table 15-2 gives a listing of interrupt request flag and interrupt mask flag names corresponding to interrupt requests. table 15-2. flags corresponding to interrupt request signal interrupt request signal name interrupt request flag interrupt mask flag intwdt tmif4 tmmk4 intp0 pif0 pmk0 intp1 pif1 pmk1 intp2 pif2 pmk2 intsr20/intcsi20 srif20 srmk20 intst20 stif20 stmk20 inttm80 tmif80 tmmk80 inttm20 tmif20 tmmk20 intad0 adif0 admk0 .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 207 (1) interrupt request flag registers (if0, if1) the interrupt request flag is set to 1 when the corresponding interrupt request is generated or an instruction is executed. it is cleared to 0 when an instruction is executed upon acknowledgement of an interrupt request or upon reset input. if0 and if1 are set with a 1-bit or 8-bit memory manipulation instruction. reset input clears these registers to 00h. figure 15-2. interrupt request flag register format cautions 1. tmif4 flag is r/w enabled only when the watchdog timer is used as an interval timer. if the watchdog timer mode 1 and 2 are used, set the tmif4 flag to 0. 2. because port 2 has an alternate function as the external interrupt input, when the output level is changed by specifying the output mode of the port function, an interrupt request flag is set. therefore, the interrupt mask flag should be set to 1 before using the output mode. 0 1 tmif20 tmif80 stif20 srif20 pif2 pif1 pif0 tmif4 if0 r/w ffe0h 00h r/w symbol address after reset interrupt request flag no interrupt request signal is generated interrupt request signal is generated; interrupt request state if <6> <5> <4> <3> <2> <1> <7> <0> 0000000 adif0 if1 r/w ffe1h 00h r/w symbol address after reset 654321 7 <0> .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 208 (2) interrupt mask flag registers (mk0, mk1) the interrupt mask flag is used to enable/disable the corresponding maskable interrupt service. mk0 and mk1 are set with a 1-bit or 8-bit memory manipulation instruction. reset input sets these registers to ffh. figure 15-3. interrupt mask flag register format cautions 1. if the tmmk4 flag is read when the watchdog timer is used in watchdog timer mode 1 and 2, its value becomes undefined. 2. because port 2 has an alternate function as the external interrupt input, when the output level is changed by specifying the output mode of the port function, an interrupt request flag is set. therefore, the interrupt mask flag should be set to 1 before using the output mode. 0 1 tmmk20 tmmk80 stmk20 srmk20 pmk2 pmk1 pmk0 tmmk4 mk0 r/w ffe4h ffh r/w symbol address after reset interrupt servicing control interrupt servicing enabled interrupt servicing disabled <6> <5> <4> <3> <2> <1> <7> <0> mk 1111111 admk0 mk1 r/w ffe5h ffh r/w symbol address after reset 654321 7 <0> .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 209 (3) external interrupt mode register 0 (intm0) this register is used to set the valid edge of intp0 to intp2. intm0 is set with an 8-bit memory manipulation instruction. reset input clears intm0 to 00h. figure 15-4. external interrupt mode register 0 format cautions 1. be sure to set bits 0 and 1 to 0. 2. before setting the intm0 register, be sure to set the corresponding interrupt mask flag ( mk = 1) to disable interrupts. after setting the intm0 register, clear the interrupt request flag ( if = 0), then clear the interrupt mask flag ( mk = 0), which will enable interrupts. 0 0 1 1 es21 es20 es11 es10 es01 es00 0 0 intm0 r/w ffech 00h r/w 76543210 0 1 0 1 0 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 symbol address after reset intp0 valid edge selection falling edge rising edge setting prohibited both rising and falling edges intp1 valid edge selection falling edge rising edge setting prohibited both rising and falling edges intp2 valid edge selection falling edge rising edge setting prohibited both rising and falling edges es00 es01 es11 es10 es20 es21 .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 210 (4) program status word (psw) the program status word is a register used to hold the instruction execution result and the current status for interrupt requests. the ie flag to set maskable interrupt enable/disable is mapped. this register can be read/written in 8-bit units and can carry out operations using a bit manipulation and dedicated instructions (ei, di). when a vectored interrupt request is acknowledged, psw is automatically saved into a stack, and the ie flag is reset to 0. it is reset from the stack by the reti and pop psw instructions. reset input sets psw to 02h. figure 15-5. program status word configuration ie z 0 ac 0 0 1 cy psw 76543210 ie 0 1 02h symbol after reset used when normal instruction is executed interrupt acknowledge enable/disable disable enable .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 211 15.4 interrupt processing operation 15.4.1 non-maskable interrupt request acknowledgement operation the non-maskable interrupt request is unconditionally acknowledged even when interrupts are disabled. it is not subject to interrupt priority control and takes precedence over all other interrupts. when the non-maskable interrupt request is acknowledged, psw and pc are saved to the stack in that order, the ie flag is reset to 0, the contents of the vector table are loaded to the pc, and then program execution branches. figure 15-6 shows the flowchart from non-maskable interrupt request generation to acknowledgement. figure 15-7 shows the timing of non-maskable interrupt request acknowledgement. figure 15-8 shows the acknowledgement operation if multiple non-maskable interrupts are generated. caution during a non-maskable interrupt service program execution, do not input another non-maskable interrupt request; if it is input, the service program will be interrupted and the new interrupt request will be acknowledged. .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 212 figure 15-6. flowchart from non-maskable interrupt request generation to acknowledgement wdtm: watchdog timer mode register wdt: watchdog timer figure 15-7. timing of non-maskable interrupt request acknowledgement figure 15-8. acknowledging non-maskable interrupt request start wdtm4 = 1 (watchdog timer mode is selected) interval timer no wdt overflows no yes reset processing no yes yes interrupt request is generated interrupt processing is started wdtm3 = 0 (non-maskable interrupt is selected) instruction instruction save psw and pc, and jump to interrupt processing interrupt processing program cpu processing tmif4 second interrupt processing first interrupt processing nmi request (second) nmi request (first) main routine .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 213 15.4.2 maskable interrupt request acknowledgement operation a maskable interrupt request can be acknowledged when the interrupt request flag is set to 1 and the corresponding interrupt mask flag is cleared to 0. a vectored interrupt request is acknowledged in the interrupt enabled status (when the ie flag is set to 1). the time required to start the interrupt processing after a maskable interrupt request has been generated is shown in table 15-3. refer to figures 15-10 and 15-11 for the interrupt request acknowledgement timing. table 15-3. time from generation of maskable interrupt request to processing minimum time maximum time note 9 clocks 19 clocks note the wait time is maximum when an interrupt request is generated immediately before bt and bf instruction. remark 1 clock: (f cpu : cpu clock) when two or more maskable interrupt requests are generated at the same time, they are acknowledged starting from the interrupt request assigned the highest priority. a pending interrupt is acknowledged when the status where it can be acknowledged is set. figure 15-9 shows the algorithm of acknowledging interrupt requests. when a maskable interrupt request is acknowledged, the contents of psw and pc are saved to the stack in that order, the ie flag is reset to 0, and the data in the vector table determined for each interrupt request is loaded to the pc, and execution branches. to return from interrupt processing, use the reti instruction. 1 f cpu .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 214 figure 15-9. interrupt acknowledgement program algorithm if: interrupt request flag mk: interrupt mask flag ie: flag to control maskable interrupt request acknowledgement (1 = enable, 0 = disable) start if = 1 ? mk = 0 ? ie = 1 ? vectored interrupt processing yes (interrupt request generated) yes yes no no no interrupt request pending interrupt request pending .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 215 figure 15-10. interrupt request acknowledgement timing (example of mov a,r) if an interrupt request flag ( if) is set before an instruction clock n (n = 4 to 10) under execution becomes nC 1, the interrupt is acknowledged after the instruction under execution is complete. figure 15-10 shows an example of the interrupt request acknowledgement timing for an 8-bit data transfer instruction mov a,r. since this instruction is executed for 4 clocks, if an interrupt occurs for 3 clocks after the execution starts, the interrupt acknowledgement processing is performed after the mov a,r instruction is completed. figure 15-11. interrupt request acknowledgement timing (when interrupt request flag is generated at the last clock during instruction execution) if an interrupt request flag ( if) is set at the last clock of the instruction, the interrupt acknowledgement processing starts after the next instruction is executed. figure 15-11 shows an example of the interrupt acknowledgement timing for an interrupt request flag that is set at the second clock of nop (2-clock instruction). in this case, the mov a,r instruction after the nop instruction is executed, and then the interrupt acknowledgement processing is performed. caution interrupt requests are reserved while the interrupt request flag register (if0, if1) or the interrupt mask flag register (mk0, mk1) is being accessed. 15.4.3 multiple interrupt processing multiple interrupt processing in which another interrupt is acknowledged while an interrupt is being processed can be processed by priority. when the priority is controlled by the default priority and two or more interrupts are generated at once, interrupt processing is performed according to the priority assigned to each interrupt request in advance (refer to table 15-1 ). clock cpu interrupt mov a,r save psw and pc, jump to interrupt processing 8 clocks interrupt processing program save psw and pc, jump to interrupt processing 8 clocks interrupt processing program clock cpu interrupt nop mov a,r .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 216 figure 15-12. example of multiple interrupts example 1. multiple interrupts are acknowledged during interrupt intxx servicing, interrupt request intyy is acknowledged, and a multiple interrupt is generated. an ei instruction is issued before each interrupt request acknowledgement, and the interrupt request acknowledgement enable state is set. example 2. a multiple interrupt is not generated because interrupts are not enabled because interrupts are not enabled in interrupt intxx servicing (an ei instruction is not issued), interrupt request intyy is not acknowledged, and a multiple interrupt is not generated. the intyy request is reserved and acknowledged after the intxx processing is performed. ie = 0: interrupt request acknowledgement disabled intyy ei main processing ei intyy processing intxx processing reti ie = 0 intxx reti ie = 0 intyy ei main processing reti intyy processing intxx processing ie = 0 intxx reti intyy is kept pending ie = 0 .com .com .com .com 4 .com u datasheet
chapter 15 interrupt functions users manual u14643ej1v0um00 217 15.4.4 interrupt request reserve some instructions may reserve the acknowledgement of an instruction request until the completion of the execution of the next instruction even if the interrupt request (maskable interrupt, non-maskable interrupt, and external interrupt) is generated during the execution. the following shows such instructions (interrupt request reserve instruction). ? manipulation instruction for the interrupt request flag register (if0, if1) ? manipulation instruction for the interrupt mask flag register (mk0, mk1) .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 218 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 219 chapter 16 standby function 16.1 standby function and configuration 16.1.1 standby function the standby function is to reduce the power consumption of the system and can be effected in the following two modes: (1) halt mode this mode is set when the halt instruction is executed. the halt mode stops the operation clock of the cpu. the system clock oscillation circuit continues oscillating. this mode does not reduce the power consumption as much as the stop mode, but is useful for resuming processing immediately when an interrupt request is generated, or for intermittent operations. (2) stop mode this mode is set when the stop instruction is executed. the stop mode stops the main system clock oscillation circuit and stops the entire system. the power consumption of the cpu can be substantially reduced in this mode. the low voltage (v dd = 1.8 v) of the data memory can be retained. therefore, this mode is useful for retaining the contents of the data memory at an extremely low current. the stop mode can be released by an interrupt request, so that this mode can be used for intermittent operation. however, some time is required until the system clock oscillation circuit stabilizes after the stop mode has been released. if processing must be resumed immediately by using an interrupt request, therefore, use the halt mode. in both modes, the previous contents of the registers, flags, and data memory before setting the standby mode are all retained. in addition, the statuses of the output latch of the i/o ports and output buffer are also retained. caution to set the stop mode, be sure to stop the operations of the peripheral hardware, and then execute the stop instruction. .com .com .com .com 4 .com u datasheet
chapter 16 standby function users manual u14643ej1v0um00 220 16.1.2 standby function control register ( m pd789104a, 789114a subseries) the wait time after the stop mode is released upon interrupt request until the oscillation stabilizes is controlled with the oscillation stabilization time select register (osts) note . osts is set with an 8-bit memory manipulation instruction. reset input sets osts to 04h. however, the oscillation stabilization time after reset input is 2 15 /f x , instead of 2 17 /f x . note m pd789104a and 789114a subseries only. the m pd789124a and 789134a subseries do not provide an oscillation stabilization time select register. the oscillation stabilization time of the m pd789124a and 789134a subseries is fixed to 2 7 /f cc . figure 16-1. oscillation stabilization time select register format caution the wait time after the stop mode in a ceramic/crystal oscillator is released does not include the time from stop mode release to clock oscillation start (a in the figure below), regardless of release by reset input or by interrupt generation. remarks 1. f x : system clock oscillation frequency (ceramic/crystal oscillation) 2. values in parentheses apply to operation with f x = 5.0 mhz. osts2 0 0 1 00000 osts2 osts1 osts0 osts r/w fffah 04h r/w 76543210 osts1 0 1 0 2 12 /f x 2 15 /f x 2 17 /f x (819 s) (6.55 ms) (26.2 ms) osts0 0 0 0 setting prohibited symbol address after reset oscillation stabilization time selection other than above m v ss a stop mode release x1 pin voltage waveform .com .com .com .com 4 .com u datasheet
chapter 16 standby function users manual u14643ej1v0um00 221 16.2 operation of standby function 16.2.1 halt mode (1) halt mode the halt mode is set by executing the halt instruction. the operation status in the halt mode is shown in the following table. table 16-1. halt mode operating status item halt mode operating status clock generator system clock can be oscillated. clock supply to cpu stops. cpu operation stopped port (output latch) retains the status before setting the halt mode. 16-bit timer 20 operable 8-bit timer/event counter 80 operable watchdog timer operable serial interface 20 operable a/d converter operation stopped multiplier operation stopped external interrupt operable note note maskable interrupt that is not masked .com .com .com .com 4 .com u datasheet
chapter 16 standby function users manual u14643ej1v0um00 222 (2) releasing halt mode the halt mode can be released by the following three types of sources: (a) releasing by unmasked interrupt request the halt mode is released by an unmasked interrupt request. in this case, if the interrupt request is able to be acknowledged, vectored interrupt processing is performed. if the interrupt is disabled, the instruction at the next address is executed. figure 16-2. releasing halt mode by interrupt remarks 1. the broken lines indicate the case where the interrupt request that has released the standby mode is acknowledged. 2. the wait time is as follows: ? when vectored interrupt processing is performed: 9 to 10 clocks ? when vectored interrupt processing is not performed: 1 to 2 clocks (b) releasing by non-maskable interrupt request the halt mode is released regardless of whether the interrupt is enabled or disabled, and vectored interrupt processing is performed. halt instruction standby release signal wait wait halt mode operating mode operating mode clock oscillation .com .com .com .com 4 .com u datasheet
chapter 16 standby function users manual u14643ej1v0um00 223 (c) releasing by reset input when the halt mode is released by the reset signal, execution branches to the reset vector address in the same manner as the ordinary reset operation, and program execution is started. figure 16-3. releasing halt mode by reset input note in the m pd789104a and 789114a subseries, 2 15 /f x : 6.55 ms (at f x = 5.0-mhz operation) in the m pd789124a and 789134a subseries, 2 7 /f cc : 32 m s (at f cc = 4.0-mhz operation) remark f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) table 16-2. operation after release of halt mode releasing source mk ie operation maskable interrupt request 0 0 executes next address instruction 0 1 executes interrupt processing 1 retains halt mode non-maskable interrupt request executes interrupt processing reset input reset processing : dont care halt instruction reset signal wait note reset period halt mode operating mode oscillation stabilization wait status clock operating mode oscillation stop oscillation oscillation .com .com .com .com 4 .com u datasheet
chapter 16 standby function users manual u14643ej1v0um00 224 16.2.2 stop mode (1) setting and operation status of stop mode the stop mode is set by executing the stop instruction. cautions 1. when the stop mode is set, the x2 or cl2 pin is internally pulled up to v dd to suppress the current leakage of the oscillation circuit block. therefore, do not use the stop mode in a system where the external clock is used as the system clock. 2. because the standby mode can be released by an interrupt request signal, the standby mode is released as soon as it is set if there is an interrupt source whose interrupt request flag is set and interrupt mask flag is reset. when the stop mode is set, therefore, the halt mode is set immediately after the stop instruction has been executed, the wait time set by the oscillation stabilization time select register (osts) elapses, and then an operation mode is set. the operation status in the stop mode is shown in the following table. table 16-3. stop mode operating status item stop mode operating status clock generator system clock oscillation stopped cpu operation stopped port (output latch) retains the status before setting the stop mode 16-bit timer 20 operation stopped 8-bit timer/event counter 80 operable note 1 watchdog timer operation stopped serial interface 20 operable note 2 a/d converter operation stopped multiplier operation stopped external interrupt operable note 3 notes 1. operation is possible only when ti80 is selected as the count clock. 2. operation is possible in both 3-wire serial i/o and uart modes while an external clock is being used. 3. maskable interrupt that is not masked .com .com .com .com 4 .com u datasheet
chapter 16 standby function users manual u14643ej1v0um00 225 (2) releasing stop mode the stop mode can be released by the following two types of sources: (a) releasing by unmasked interrupt request the stop mode can be released by an unmasked interrupt request. in this case, if the interrupt is able to be acknowledged, vectored interrupt processing is performed, after the oscillation stabilization time has elapsed. if the interrupt is disabled, the instruction at the next address is executed. figure 16-4. releasing stop mode by interrupt note osts is not provided in the m pd789124a and 789134a subseries, and the wait time is fixed to 2 7 /f cc . remark the broken lines indicate the case where the interrupt request that has released the standby mode is acknowledged. stop instruction standby release signal wait note (set time by osts) stop mode operating mode oscillation stabilization wait status clock operating mode oscillation stop oscillation oscillation .com .com .com .com 4 .com u datasheet
chapter 16 standby function users manual u14643ej1v0um00 226 (b) releasing by reset input when the stop mode is released by the reset signal, the reset operation is performed after the oscillation stabilization time has elapsed. figure 16-5. releasing stop mode by reset input note in the m pd789104a and 789114a subseries, 2 15 /f x : 6.55 ms (at f x = 5.0-mhz operation) in the m pd789124a and 789134a subseries, 2 7 /f cc : 32 m s (at f cc = 4.0-mhz operation) remark f x : system clock oscillation frequency (ceramic/crystal oscillation) f cc : system clock oscillation frequency (rc oscillation) table 16-4. operation after release of stop mode releasing source mk ie operation maskable interrupt request 0 0 executes next address instruction 0 1 executes interrupt processing 1 retains stop mode reset input reset processing : dont care stop instruction reset signal wait note stop mode operating mode oscillation stabilization wait status clock operating mode oscillation stop oscillation oscillation reset period .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 227 chapter 17 reset function the following two operations are available to generate reset signals. (1) external reset input with reset pin (2) internal reset by program runaway time detection with watchdog timer external and internal reset have no functional differences. in both cases, program execution starts at the addresses 0000h and 0001h by reset signal input. when a low level is input to the reset pin or the watchdog timer overflows, a reset is applied and each hardware item is set to the status shown in table 17-1. each pin has a high impedance during reset input or during the oscillation stabilization time just after reset clear. when a high level is input to the reset pin, the reset is cleared and program execution is started after the oscillation stabilization time has elapsed. the reset applied by the watchdog timer overflow is automatically cleared after reset, and program execution is started after the oscillation stabilization time has elapsed (see figures 17-2 through 17- 4 ). cautions 1. for an external reset, input a low level for 10 m s or more to the reset pin. 2. when the stop mode is cleared by reset, the stop mode contents are held during reset input. however, the port pins become high impedance. figure 17-1. block diagram of reset function reset interrupt function count clock reset control circuit watchdog timer over- flow reset signal stop .com .com .com .com 4 .com u datasheet
chapter 17 reset function users manual u14643ej1v0um00 228 figure 17-2. reset timing by reset input figure 17-3. reset timing by overflow in watchdog timer figure 17-4. reset timing by reset input in stop mode x1, cl1 reset internal reset signal port pin during normal operation reset period (oscillation stops) oscillation stabilization time wait normal operation (reset processing) delay delay hi-z x1, cl1 internal reset signal port pin overflow in watchdog timer during normal operation reset period (oscillation continues) oscillation stabilization time wait normal operation (reset processing) hi-z x1, cl1 reset internal reset signal port pin hi-z delay delay stop instruction execution during normal operation stop status (oscillation stops) reset period (oscillation stops) oscillation stabilization time wait normal operation (reset processing) .com .com .com .com 4 .com u datasheet
chapter 17 reset function users manual u14643ej1v0um00 229 table 17-1. hardware status after reset (1/2) hardware status after reset program counter (pc) note 1 the contents of reset vector tables (0000h and 0001h) are set. stack pointer (sp) undefined program status word (psw) 02h ram data memory undefined note 2 general register undefined note 2 port (p0 to p2, p5) (output latch) 00h port mode register (pm0 to pm2, pm5) ffh pull-up resistor option register 0 (pu0) 00h pull-up resistor option register b2 (pub2) 00h processor clock control register (pcc) 02h oscillation stabilization time select register (osts) note 3 04h 16-bit timer 20 timer counter (tm20) 0000h compare register (cr20) ffffh mode control register (tmc20) 00h capture register (tpc20) undefined 8-bit timer/event counter 80 timer counter (tm80) 00h compare register (cr80) undefined mode control register (tmc80) 00h watchdog timer timer clock select register (tcl2) 00h mode register (wdtm) 00h a/d converter mode register (adm0) 00h input channel specification register (ads0) 00h conversion result register (adcr0) undefined serial interface 20 mode register (csim20) 00h asynchronous serial interface mode register (asim20) 00h asynchronous serial interface status register (asis20) 00h baud rate generator control register (brgc20) 00h transmit shift register (txs20) ffh receive buffer register (rxb20) undefined notes 1. during reset input and oscillation stabilization time wait, only the pc contents among the hardware statuses become undefined. all other hardware remains unchanged after reset. 2. if the reset signal is input in the standby mode, the status before reset is retained even after reset. 3. m pd789104a, 789114a subseries only .com .com .com .com 4 .com u datasheet
chapter 17 reset function users manual u14643ej1v0um00 230 table 17-1. hardware status after reset (2/2) hardware status after reset multiplier 16-bit multiplication result storage register (mul0) undefined data register a (mra0) undefined data register b (mrb0) undefined control register (mulc0) 00h interrupt request flag register (if0, if1) 00h mask flag register (mk0, mk1) ffh external interrupt mode register (intm0) 00h .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 231 chapter 18 m pd78F9116A, 78f9136a the m pd78F9116A is a version with flash memory instead of the internal rom of the mask rom version in the m pd789104a and 789114a subseries. the m pd78f9136a is a version with flash memory instead of the internal rom of the mask rom version in the m pd789124a and 789134a subseries. the differences between the flash memory and the mask rom versions are shown in table 18-1. table 18-1. differences between flash memory and mask rom versions item flash memory mask rom m pd78F9116A m pd789101a m pd789102a m pd789104a m pd789111a m pd789112a m pd789114a m pd78f9136a m pd789121a m pd789122a m pd789124a m pd789131a m pd789132a m pd789134a internal rom 16 kbytes 2 kbytes 4 kbytes 8 kbytes memory (flash memory) high-speed ram 256 bytes pull-up resistor 12 (software control only) 16 (software control: 12, mask option specification: 4) v pp pin provided not provided electrical specifications refer to the individual data sheets. cautions 1. there are differences in noise immunity and noise radiation between the flash memory versions and mask rom versions. when pre-producing an application set with the flash memory version and then mass-producing it with the mask rom version, be sure to conduct sufficient evaluations for the commercial samples (not engineering samples) of the mask rom versions. 2. a/d conversion result register 0 (adcr0) is manipulated by an 8-bit memory manipulation instruction or a 16-bit memory manipulation instruction, when used as an 8-bit a/d converter ( m pd789104a, 789124a subseries) or 10-bit a/d converter ( m pd789114a, 789134a subseries), respectively. however, if the m pd78F9116A is used as the flash memory version of the m pd789101a, 789102a, 789104a, adcr0 can be manipulated by an 8-bit memory manipulation instruction, providing an object file has been assembled in the m pd789101a, 789102a, 789104a. if the m pd78f9136a is used as the flash memory version of the m pd789121a, 789122a, 789124a, adcr0 can be manipulated by an 8-bit memory manipulation instruction, providing an object file has been assembled in the m pd789121a, 789122a, 789124a. .com .com .com .com 4 .com u datasheet
chapter 18 m pd78F9116A, 78f9136a users manual u14643ej1v0um00 232 10 v v ss v dd v pp v dd v ss reset 12 n 18.1 flash memory programming the on-chip program memory in the m pd78F9116A, 78f9136a is flash memory. the flash memory can be written with the m pd78F9116A mounted on the target system (on-board). connect the dedicated flash programmer (flashpro iii (part number: fl-pr3, pg-fp3)) to the host machine and target system to write the flash memory. remark fl-pr3 is made by naito densei machida mfg. co., ltd. 18.1.1 selecting communication mode the flash memory is written by using flashpro iii and by means of serial communication. select a communication mode from those listed in table 18-2. to select a communication mode, the format shown in figure 18-1 is used. each communication mode is selected by the number of v pp pulses shown in table 18-2. table 18-2. communication mode communication mode pins used number of v pp pulses 3-wire serial i/o sck20/asck20/p20 0 so20/txd20/p21 si20/rxd20/p22 uart txd20/so20/p21 8 rxd20/si20/p22 pseudo 3-wire mode note p00 (serial clock input) 12 p01 (serial data output) p02 (serial data input) note serial transfer is performed by controlling a port by software. caution be sure to select a communication mode based on the v pp pulse number shown in table 18-2. figure 18-1. communication mode selection format .com .com .com .com 4 .com u datasheet
chapter 18 m pd78F9116A, 78f9136a users manual u14643ej1v0um00 233 18.1.2 function of flash memory programming by transmitting/receiving commands and data in the selected communication mode, operations such as writing to the flash memory are performed. table 18-3 shows the major functions of flash memory programming. table 18-3. functions of flash memory programming function description batch erase erases all contents of memory batch blank check checks erased state of entire memory data write write to flash memory based on write start address and number of data written (number of bytes) batch verify compares all contents of memory with input data 18.1.3 flashpro iii connection example connection between the flashpro iii and the m pd78F9116A and 78f9136a differs depending on the communication mode (3-wire serial i/o, uart, or pseudo 3-wire mode). figures 18-2 to 18-4 show the connection examples in the respective modes. (a) connection between m pd78F9116A and flashpro iii figure 18-2. flashpro iii connection in 3-wire serial i/o mode note n = 1, 2 v pp n note v dd reset sck so si gnd v pp v dd , av dd reset sck20 si20 so20 v ss , av ss clk x1 flashpro iii pd78F9116A m .com .com .com .com 4 .com u datasheet
chapter 18 m pd78F9116A, 78f9136a users manual u14643ej1v0um00 234 figure 18-3. flashpro iii connection in uart mode note n = 1, 2 figure 18-4. flashpro iii connection in pseudo 3-wire mode (when p0 is used) note n = 1, 2 v pp n note v dd reset so si gnd v pp v dd , av dd reset rxd20 txd20 v ss , av ss clk x1 flashpro iii pd78F9116A m v pp n note v dd reset sck so si gnd v pp v dd , av dd reset p00 (serial clock) clk x1 p02 (serial input) p01 (serial output) v ss , av ss flashpro iii pd78F9116A m .com .com .com .com 4 .com u datasheet
chapter 18 m pd78F9116A, 78f9136a users manual u14643ej1v0um00 235 (b) connection between m pd78f9136a and flashpro iii figure 18-5. flashpro iii connection in 3-wire serial i/o mode note n = 1, 2 figure 18-6. flashpro iii connection in uart mode note n = 1, 2 v pp n note v dd reset sck so si gnd v pp v dd , av dd reset sck20 si20 so20 v ss , av ss clk p03 flashpro iii pd78f9136a m v pp n note v dd reset so si gnd v pp v dd , av dd reset rxd20 txd20 v ss , av ss clk p03 flashpro iii pd78f9136a m .com .com .com .com 4 .com u datasheet
chapter 18 m pd78F9116A, 78f9136a users manual u14643ej1v0um00 236 figure 18-7. flashpro iii connection in pseudo 3-wire mode (when p0 is used) note n = 1, 2 v pp n note v dd reset sck so si gnd v pp v dd , av dd reset p00 (serial clock) clk p03 p02 (serial input) p01 (serial output) v ss , av ss flashpro iii pd78f9136a m .com .com .com .com 4 .com u datasheet
chapter 18 m pd78F9116A, 78f9136a users manual u14643ej1v0um00 237 18.1.4 example of settings for flashpro iii (pg-fp3) make the following setting when writing to flash memory using flashpro iii (pg-fp3). <1> load the parameter file. <2> select serial mode and serial clock using the type command. <3> an example of the settings for the pg-fp3 is shown below. table 18-4. example of settings for pg-fp3 communication mode example of setting for pg-fp3 number of v pp pulses note 1 3-wire serial i/o comm port sio-ch0 0 cpu clk on target board in flashpro on target board 4.1943 mhz sio clk 1.0 mhz in flashpro 4.0 mhz sio clk 1.0 mhz uart comm port uart-ch0 8 cpu clk on target board on target board 4.1943 mhz uart bps 9600 bps note 2 pseudo 3-wire comm port port a 12 cpu clk on target board in flashpro on target board 4.1943 mhz sio clk 1.0 khz in flashpro 4.0 mhz sio clk 1.0 khz notes 1. the number of v pp pulses supplied from flashpro iii when serial communication is initialized. the pins to be used for communication are determined according to the number of these pulses. 2. select one of 9600 bps, 19200 bps, 38400 bps, or 76800 bps. remark comm port: selection of serial port sio clk: selection of serial clock frequency cpu clk: selection of source of cpu clock to be input .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 238 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 239 chapter 19 mask option (mask rom version) table 19-1. selection of mask option for pins pin mask option p50 to p53 on-chip pull-up resistor can be specified in 1-bit units. for p50 to p53 (port 5), an on-chip pull-up resistor can be specified by the mask option. the mask option is specified in 1-bit units. caution the flash memory versions do not provide the on-chip pull-up resistor function. .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 240 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 241 chapter 20 instruction set this chapter lists the instruction set of the m pd789104a/114a/124a/134a subseries. for the details of the operation and machine language (instruction code) of each instruction, refer to 78k/0s series users manual instruction (u11047e) . 20.1 operation 20.1.1 operand identifiers and description methods operands are described in operand column of each instruction in accordance with the description method of the instruction operand identifier (refer to the assembler specifications for detail). when there are two or more description methods, select one of them. alphabetic letters in capitals and symbols, #, !, $, and [ ] are key words and are described as they are. each symbol has the following meaning. ? #: immediate data specification ? $: relative address specification ? !: absolute address specification ? [ ]: indirect address specification in the case of immediate data, describe an appropriate numeric value or a label. when using a label, be sure to describe the #, !, $ and [ ] symbols. for operand register identifiers, r and rp, either function names (x, a, c, etc.) or absolute names (names in parenthesis in the table below, r0, r1, r2, etc.) can be used for description. table 20-1. operand identifiers and description methods identifier description method r x (r0), a (r1), c (r2), b (r3), e (r4), d (r5), l (r6), h (r7) rp ax (rp0), bc (rp1), de (rp2), hl (rp3) sfr special-function register symbol saddr fe20h to ff1fh immediate data or labels saddrp fe20h to ff1fh immediate data or labels (even addresses only) addr16 0000h to ffffh immediate data or labels (only even addresses for 16-bit data transfer instructions) addr5 0040h to 007fh immediate data or labels (even addresses only) word 16-bit immediate data or label byte 8-bit immediate data or label bit 3-bit immediate data or label remark refer to table 4-3 special function register list for symbols of special function registers. .com .com .com .com 4 .com u datasheet
242 chapter 20 instruction set users manual u14643ej1v0um00 20.1.2 description of operation column a: a register; 8-bit accumulator x: x register b: b register c: c register d: d register e: e register h: h register l: l register ax: ax register pair; 16-bit accumulator bc: bc register pair de: de register pair hl: hl register pair pc: program counter sp: stack pointer psw: program status word cy: carry flag ac: auxiliary carry flag z: zero flag ie: interrupt request enable flag nmis: flag indicating non-maskable interrupt servicing in progress ( ): memory contents indicated by address or register contents in parenthesis h , l : higher 8 bits and lower 8 bits of 16-bit register : logical product (and) : logical sum (or) : exclusive logical sum (exclusive or) : inverted data addr16: 16-bit immediate data or label jdisp8: signed 8-bit data (displacement value) 20.1.3 description of flag operation column (blank): unchanged 0: cleared to 0 1: set to 1 : set/cleared according to the result r: previously saved value is restored .com .com .com .com 4 .com u datasheet
chapter 20 instruction set users manual u14643ej1v0um00 243 20.2 operation list flag mnemonic operands byte clock operation zaccy mov r,#byte 3 6 r ? byte saddr,#byte 3 6 (saddr) ? byte sfr,#byte 3 6 sfr ? byte a,r note 1 24a ? r r,a note 1 24r ? a a,saddr 2 4 a ? (saddr) saddr,a 2 4 (saddr) ? a a,sfr 2 4 a ? sfr sfr,a 2 4 sfr ? a a,!addr16 3 8 a ? (addr16) !addr16,a 3 8 (addr16) ? a psw,#byte 3 6 psw ? byte a,psw 2 4 a ? psw psw,a 2 4 psw ? a a,[de] 1 6 a ? (de) [de],a 1 6 (de) ? a a,[hl] 1 6 a ? (hl) [hl],a 1 6 (hl) ? a a,[hl+byte] 2 6 a ? (hl+byte) [hl+byte],a 2 6 (hl+byte) ? a xch a,x 1 4 a ? x a,r note 2 26a ? r a,saddr 2 6 a ? (saddr) a,sfr 2 6 a ? sfr a,[de] 1 8 a ? (de) a,[hl] 1 8 a ? (hl) a,[hl+byte] 2 8 a ? (hl+byte) notes 1. except r = a. 2. except r = a, x. remark one instruction clock cycle is one cpu clock cycle (f cpu ) selected by the processor clock control register (pcc). .com .com .com .com 4 .com u datasheet
244 chapter 20 instruction set users manual u14643ej1v0um00 flag mnemonic operands byte clock operation zaccy movw rp,#word 3 6 rp ? word ax,saddrp 2 6 ax ? (saddrp) saddrp,ax 2 8 (saddrp) ? ax ax,rp note 1 4 ax ? rp rp,ax note 1 4 rp ? ax xchw ax,rp note 1 8 ax ? rp add a,#byte 2 4 a,cy ? a + byte saddr,#byte 3 6 (saddr),cy ? (saddr) + byte a,r 2 4 a,cy ? a + r a,saddr 2 4 a,cy ? a + (saddr) a,!addr16 3 8 a,cy ? a + (addr16) a,[hl] 1 6 a,cy ? a + (hl) a,[hl+byte] 2 6 a,cy ? a + (hl+byte) addc a,#byte 2 4 a,cy ? a+ byte + cy saddr,#byte 3 6 (saddr),cy ? (saddr) + byte + cy a,r 2 4 a,cy ? a + r + cy a,saddr 2 4 a,cy ? a + (saddr) + cy a,!addr16 3 8 a,cy ? a + (addr16) + cy a,[hl] 1 6 a,cy ? a + (hl) + cy a,[hl+byte] 2 6 a,cy ? a + (hl+byte) + cy sub a,#byte 2 4 a,cy ? a C byte saddr,#byte 3 6 (saddr), cy ? (saddr) C byte a,r 2 4 a,cy ? a C r a,saddr 2 4 a,cy ? a C (saddr) a,!addr16 3 8 a,cy ? a C (addr16) a,[hl] 1 6 a,cy ? a C (hl) a,[hl+byte] 2 6 a,cy ? a C (hl+byte) note only when rp = bc, de, or hl. remark one instruction clock cycle is one cpu clock cycle (f cpu ) selected by the processor clock control register (pcc). .com .com .com .com 4 .com u datasheet
chapter 20 instruction set users manual u14643ej1v0um00 245 flag mnemonic operands byte clock operation zaccy subc a,#byte 2 4 a,cy ? a C byte C cy saddr,#byte 3 6 (saddr),cy ? (saddr) C byte C cy a,r 2 4 a,cy ? a C r C cy a,saddr 2 4 a,cy ? a C (saddr) C cy a,!addr16 3 8 a,cy ? a C (addr16) C cy a,[hl] 1 6 a,cy ? a C (hl) C cy a,[hl+byte] 2 6 a,cy ? a C (hl+byte) C cy and a,#byte 2 4 a ? a byte saddr,#byte 3 6 (saddr) ? (saddr) byte a,r 2 4 a ? a r a,saddr 2 4 a ? a (saddr) a,!addr16 3 8 a ? a (addr16) a,[hl] 1 6 a ? a (hl) a,[hl+byte] 2 6 a ? a (hl+byte) or a,#byte 2 4 a ? a byte saddr,#byte 3 6 (saddr) ? (saddr) byte a,r 2 4 a ? a r a,saddr 2 4 a ? a (saddr) a,!addr16 3 8 a ? a (addr16) a,[hl] 1 6 a ? a (hl) a,[hl+byte] 2 6 a ? a (hl+byte) xor a,#byte 2 4 a ? a byte saddr,#byte 3 6 (saddr) ? (saddr) byte a,r 2 4 a ? a r a,saddr 2 4 a ? a (saddr) a,!addr16 3 8 a ? a (addr16) a,[hl] 1 6 a ? a (hl) a,[hl+byte] 2 6 a ? a (hl+byte) remark one instruction clock cycle is one cpu clock cycle (f cpu ) selected by the processor clock control register (pcc). .com .com .com .com 4 .com u datasheet
246 chapter 20 instruction set users manual u14643ej1v0um00 flag mnemonic operands byte clock operation zaccy cmp a,#byte 2 4 a C byte saddr,#byte 3 6 (saddr) C byte a,r 2 4 a C r a,saddr 2 4 a C (saddr) a,!addr16 3 8 a C (addr16) a,[hl] 1 6 a C (hl) a,[hl+byte] 2 6 a C (hl+byte) addw ax,#word 3 6 ax,cy ? ax + word subw ax,#word 3 6 ax,cy ? ax C word cmpw ax,#word 3 6 ax C word inc r24r ? r + 1 saddr 2 4 (saddr) ? (saddr) + 1 dec r24r ? r C 1 saddr 2 4 (saddr) ? (saddr) C 1 incw rp 1 4 rp ? rp + 1 decw rp 1 4 rp ? rp C 1 ror a,1 1 2 (cy,a 7 ? a 0 , a mC1 ? a m ) 1 rol a,1 1 2 (cy,a 0 ? a 7 , a m+1 ? a m ) 1 rorc a,1 1 2 (cy ? a 0 , a 7 ? cy, a mC1 ? a m ) 1 rolc a,1 1 2 (cy ? a 7 , a 0 ? cy, a m+1 ? a m ) 1 set1 saddr.bit 3 6 (saddr.bit) ? 1 sfr.bit 3 6 sfr.bit ? 1 a.bit 2 4 a.bit ? 1 psw.bit 3 6 psw.bit ? 1 [hl].bit 2 10 (hl).bit ? 1 clr1 saddr.bit 3 6 (saddr.bit) ? 0 sfr.bit 3 6 sfr.bit ? 0 a.bit 2 4 a.bit ? 0 psw.bit 3 6 psw.bit ? 0 [hl].bit 2 10 (hl).bit ? 0 set1 cy 1 2 cy ? 11 clr1 cy 1 2 cy ? 00 not1 cy 1 2 cy ? cy remark one instruction clock cycle is one cpu clock cycle (f cpu ) selected by the processor clock control register (pcc). .com .com .com .com 4 .com u datasheet
chapter 20 instruction set users manual u14643ej1v0um00 247 flag mnemonic operands byte clock operation zaccy call !addr16 3 6 (sp C 1) ? (pc + 3) h , (sp C 2) ? (pc + 3) l , pc ? addr16, sp ? sp C 2 callt [addr5] 1 8 (sp C 1) ? (pc + 1) h , (sp C 2) ? (pc + 1) l , pc h ? (00000000, addr5 + 1), pc l ? (00000000, addr5), sp ? sp C 2 ret 16pc h ? (sp + 1), pc l ? (sp), sp ? sp + 2 reti 18pc h ? (sp + 1), pc l ? (sp), r r r psw ? (sp + 2), sp ? sp + 3, nmis ? 0 push psw 1 2 (sp C 1) ? psw, sp ? sp C 1 rp 1 4 (sp C 1) ? rp h , (sp C 2) ? rp l , sp ? sp C 2 pop psw 1 4 psw ? (sp), sp ? sp + 1 r r r rp 1 6 rp h ? (sp + 1), rp l ? (sp), sp ? sp + 2 movw sp, ax 2 8 sp ? ax ax, sp 2 6 ax ? sp br !addr16 3 6 pc ? addr16 $addr16 2 6 pc ? pc + 2 + jdisp8 ax 1 6 pc h ? a, pc l ? x bc $addr16 2 6 pc ? pc + 2 + jdisp8 if cy = 1 bnc $addr16 2 6 pc ? pc + 2 + jdisp8 if cy = 0 bz $saddr16 2 6 pc ? pc + 2 + jdisp8 if z = 1 bnz $saddr16 2 6 pc ? pc + 2 + jdisp8 if z = 0 bt saddr.bit,$addr16 4 10 pc ? pc + 4 + jdisp8 if (saddr.bit) = 1 sfr.bit,$addr16 4 10 pc ? pc + 4 + jdisp8 if sfr.bit = 1 a.bit,$addr16 3 8 pc ? pc + 3 + jdisp8 if a.bit = 1 psw.bit,$addr16 4 10 pc ? pc + 4 + jdisp8 if psw.bit = 1 bf saddr.bit,$addr16 4 10 pc ? pc + 4 + jdisp8 if (saddr.bit) = 0 sfr.bit,$addr16 4 10 pc ? pc + 4 + jdisp8 if sfr.bit = 0 a.bit,$addr16 3 8 pc ? pc + 3 + jdisp8 if a.bit = 0 psw.bit,$addr16 4 10 pc ? pc + 4 + jdisp8 if psw.bit = 0 dbnz b,$addr16 2 6 b ? b C 1, then pc ? pc + 2 + jdisp8 if b 1 0 c,$addr16 2 6 c ? c C 1, then pc ? pc + 2 + jdisp8 if c 1 0 saddr,$addr16 3 8 (saddr) ? (saddr) C 1, then pc ? pc + 3 + jdisp8 if (saddr) 1 0 nop 1 2 no operation ei 3 6 ie ? 1 (enable interrupt) di 3 6 ie ? 0 (disable interrupt) halt 1 2 set halt mode stop 1 2 set stop mode remark one instruction clock cycle is one cpu clock cycle (f cpu ) selected by the processor clock control register (pcc). .com .com .com .com 4 .com u datasheet
248 chapter 20 instruction set users manual u14643ej1v0um00 20.3 instructions listed by addressing type (1) 8-bit instructions mov, xch, add, addc, sub, subc, and, or, xor, cmp, inc, dec, ror, rol, rorc, rolc, push, pop, dbnz 2nd operand #byte a r sfr saddr !addr16 psw [de] [hl] [hl+byte] $addr16 1 none 1st operand a add mov note mov mov mov mov mov mov mov ror addc xch note xch xch xch xch xch rol sub add add add add add rorc subc addc addc addc addc addc rolc and sub sub sub sub sub or subc subc subc subc subc xor and and and and and cmp or or or or or xor xor xor xor xor cmp cmp cmp cmp cmp r mov mov inc dec b, c dbnz sfr mov mov saddr mov mov dbnz inc add dec addc sub subc and or xor cmp !addr16 mov psw mov mov push pop [de] mov [hl] mov [hl+byte] mov note except r = a. .com .com .com .com 4 .com u datasheet
chapter 20 instruction set users manual u14643ej1v0um00 249 (2) 16-bit instructions movw, xchw, addw, subw, cmpw, push, pop, incw, decw 2nd operand #word ax rp note saddrp sp none 1st operand ax addw movw movw movw subw xchw cmpw rp movw movw note incw decw push pop saddrp movw sp movw note only when rp = bc, de, or hl. (3) bit manipulation instructions set1, clr1, not1, bt, bf 2nd operand $addr16 none 1st operand a.bit bt set1 bf clr1 sfr.bit bt set1 bf clr1 saddr.bit bt set1 bf clr1 psw.bit bt set1 bf clr1 [hl].bit set1 clr1 cy set1 clr1 not1 .com .com .com .com 4 .com u datasheet
250 chapter 20 instruction set users manual u14643ej1v0um00 (4) call instructions/branch instructions call, callt, br, bc, bnc, bz, bnz, dbnz 2nd operand ax !addr16 [addr5] $addr16 1st operand basic instructions br call callt br br bc bnc bz bnz compound instructions dbnz (5) other instructions ret, reti, nop, ei, di, halt, stop .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 251 appendix a development tools the following development tools are available for the development of systems that employ the m pd789104a/114a/ 124a/134a subseries. figure a-1 shows the development tool configuration. ? support of the pc98-nx series unless otherwise specified, the m pd789104a/114a/124a/134a subseries supported by ibm pc/at? and compatibles can be used for the pc98-nx series. when using the pc98-nx series, refer to the descriptions of the ibm pc/at and compatibles. ? windows unless otherwise specified, windows indicates the following oss. windows 3.1 windows 95 windows nt? ver. 4.0 .com .com .com .com 4 .com u datasheet
appendix a development tools users manual u14643ej1v0um00 252 figure a-1. development tool configuration language processing software ?assembler package ?c compiler package ?system simulator ?device file ?c compiler source file ?integrated debugger embedded software ?os host machine (pc or ews) interface adapter in-circuit emulator emulation board emulation probe conversion socket target system flash programmer flash memory write adapter flash memory flash memory write environment power supply unit .com .com .com .com 4 .com u datasheet
appendix a development tools users manual u14643ej1v0um00 253 a.1 language processing software ra78k0s a program that converts a program written in mnemonic into object codes that can assembler package be executed by microcontrollers. in addition, automatic functions to generate symbol tables and optimize branch instructions are also provided. used in combination with a device file (df789136) (sold separately). the assembler package is a dos-based application but may be used in the windows environment by using the project manager of windows (included in the assembler package). part number: m s ra78k0s cc78k0s a program that converts a program written in c language into object codes that can c compiler package be executed by microcontrollers. used in combination with an assembler package (ra78k0s) and device file (df789136) (both sold separately). the c compiler package is a dos-based application but may be used in the windows environment by using the project manager of windows (included in the assembler package). part number: m s cc78k0s df789136 note file containing the information inherent to the device. device file used in combination with ra78k0s, cc78k0s, and sm78k0s (all sold separately). part number: m s df789136 cc78k0s-l source file of functions for generating the object library included in the c compiler c compiler source file package. necessary for changing the object library included in the c compiler package according to customers specifications. since this is a source file, its working environment does not depend on any particular operating system. part number: m s cc78k0s-l note df789136 is a common file that can be used with ra78k0s, cc78k0s, and sm78k0s. remark in the part number differs depending on the host machine and operating system to be used. m s ra78k0s m s cc78k0s m s df789136 m s cc78k0s-l host machine os supply media aa13 pc-9800 series japanese windows note 3.5" 2hd fd ab13 ibm pc/at and compatibles japanese windows note 3.5" 2hc fd 3p16 hp9000 series 700? hp-ux? (rel.10.10) dat (dds) 3k13 sparcstation? sunos? (rel.4.1.1) 3.5" 2hc fd 3k15 solaris? (rel.2.5.1) 1/4" cgmt 3r13 news? (risc) news-os? (rel.6.1) 3.5" 2hc fd note also operates in the dos environment .com .com .com .com 4 .com u datasheet
appendix a development tools users manual u14643ej1v0um00 254 a.2 flash memory writing tools flashpro iii dedicated flash programmer for microcontrollers incorporating flash memory (part no. fl-pr3, pg-fp3) flash programmer fa-30mc adapter for writing to flash memory and connected to flashpro iii. flash memory writing adapter ? fa-30mc: for 30-pin plastic ssop (mc-5a4 type) remark the fl-pr3 and fa-30mc are products made by naito densei machida mfg. co., ltd. (tel +81-44-822-3813). a.3 debugging tools a.3.1 hardware in-circuit emulator for debugging the hardware and software of an application system using the 78k/0s series. supports an integrated debugger (id78k0s-ns). used in combination with an ac adapter, emulation probe, and interface adapter for connecting the host machine. adapter for supplying power from an ac 100 to 240 v outlet. adapter necessary when using a pc-9800 series pc (except notebook type) as the host machine of the ie-78k0s-ns (c bus supported) pc card and interface cable necessary when using a notebook pc as the host machine of the ie-78k0s-ns (pcmcia socket supported) interface adapter necessary when using an ibm pc/at or compatible as the host machine of the ie-78k0s-ns (isa bus supported) adapter necessary when using a personal computer incorporating the pci bus as the host machine of the ie-78k0s-ns board for emulating the peripheral hardware inherent to the device. used in combination with an in-circuit emulator. probe for connecting the in-circuit emulator and target system. this is for a 30-pin plastic ssop (mc-5a4 type). conversion socket to connect the np-36gs and a target system board on which a 30-pin plastic ssop (mc-5a4 type) can be mounted. remark the np-36gs, and ngs-30 are products made by naito densei machida mfg. co., ltd. for details of these products, contact naito densei machida mfg. co., ltd. (tel +81-44-822-3813). ie-78k0s-ns in-circuit emulator ie-70000-mc-ps-b ac adapter ie-70000-98-if-c interface adapter ie-70000-cd-if-a pc card interface ie-70000-pc-if-c interface adapter ie-70000-pci-if interface adapter ie-789136-ns-em1 emulation board np-36gs emulation probe ngs-30 conversion socket .com .com .com .com 4 .com u datasheet
appendix a development tools users manual u14643ej1v0um00 255 id78k0s-ns integrated debugger (supports in-circuit emulator ie-78k0s-ns) a.3.2 software control program for debugging the 78k/0s series. this program provides a graphical user interface. it runs on windows for personal computer users and on osf/motif? for engineering work station users, and has visual designs and operationability that comply with these operating systems. in addition, it has a powerful debug function that supports c language. therefore, trace results can be displayed at a c language level by the window integration function that links the source program, disassembled display, and memory display, to the trace result. this software also allows users to add other function extension modules such as a task debugger and system performance analyzer to improve the debug efficiency for programs using a real-time operating system. used in combination with a device file (df789136) (sold separately). part number: m s id78k0s-ns remark in the part number differs depending on the host machine and operating system to be used. m s id78k0s-ns host machine os supply media aa13 pc-9800 series japanese windows note 3.5" 2hd fd ab13 ibm pc/at compatibles japanese windows note 3.5" 2hc fd note also operates in the dos environment. sm78k0s debugs the program at c source level or assembler level while simulating operation of the system simulator target system on the host machine. sm78k0s runs in windows. by using sm78k0s, the logic and performance of an application can be verified independently of hardware development even when the in-circuit emulator is not used. this enhances development efficiency and improves software quality. used in combination with a device file (df789136) (sold separately). part number: m s sm78k0s df789136 note file containing the information inherent to the device. device file used in combination with the ra78k0s, cc78k0s, and sm78k0s (all sold separately). part number: m s df789136 note df789136 is a common file that can be used with the ra78k0s, cc78k0s, and sm78k0s. remark in the part number differs depending on the host machine and operating system to be used. m s sm78k0s host machine os supply media aa13 pc-9800 series japanese windows note 3.5" 2hd fd ab13 ibm pc/at compatibles japanese windows note 3.5" 2hc fd note also operates in the dos environment. .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 256 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 257 appendix b embedded software the following embedded software products are available for efficient program development and maintenance of the m pd789104a/114a/124a/134a subseries. mx78k0s is a subset os that is based on the m itron specification. supplied with the mx78k0s nucleus. the mx78k0s os controls tasks, events, and time. in task control, the mx78k0s os controls task execution order, and then perform the switching process to a task to be executed. the mx78k0s is a dos-based application. use this software in the dos pane when running it on windows. part number: m s mx78k0s remark in the part number differ depending on the host machine and os used. m s mx78k0s host machine os supply media aa13 pc-9800 series japanese windows note 3.5" 2hd fd ab13 ibm pc/at compatibles japanese windows note 3.5" 2hd fd bb13 english windows note note can also be operated in the dos environment. mx78k0s os .com .com .com .com 4 .com u datasheet
258 users manual u14643ej1v0um00 [memo] .com .com .com .com 4 .com u datasheet
users manual u14643ej1v0um00 259 appendix c register index c.1 register name index (alphabetic order) 8-bit compare register 80 (cr80) ................................................................................................................ 117 8-bit timer mode control register 80 (tmc80) ............................................................................................. 118 8-bit timer counter 80 (tm80) ...................................................................................................................... 117 16-bit compare register 20 (cr20) .............................................................................................................. 106 16-bit multiplication result storage register 0 (mul0) ................................................................................. 199 16-bit timer capture register 20 (tcp20) ..................................................................................................... 106 16-bit timer mode control register 20 (tmc20) ........................................................................................... 107 16-bit timer counter 20 (tm20) .................................................................................................................... 106 [a] asynchronous serial interface mode register 20 (asim20) ............................................... 168, 175, 178, 190 asynchronous serial interface status register 20 (asis20) ................................................................ 170, 179 a/d conversion result register 0 (adcr0) ................................................................................................... 136 a/d converter mode register 0 (adm0) ....................................................................................................... 138 analog input channel specification register 0 (ads0) ................................................................................ 139 [b] baud rate generator control register 20 (brgc20) ................................................................... 171, 180, 191 [e] external interrupt mode register 0 (intm0) ................................................................................................. 209 [i] interrupt mask flag register 0 (mk0) ............................................................................................................ 208 interrupt mask flag register 1 (mk1) ............................................................................................................ 208 interrupt request flag register 0 (if0) ........................................................................................................... 207 interrupt request flag register 1 (if1) ........................................................................................................... 207 [m] multiplication data register a0 (mra0) ........................................................................................................ 199 multiplication data register b0 (mrb0) ........................................................................................................ 199 multiplier control register 0 (mulc0) ........................................................................................................... 201 [o] oscillation stabilization time select register (osts) ................................................................................... 220 [p] port 0 (p0) ............................................................................................................................... ........................ 75 port 1 (p1) ............................................................................................................................... ........................ 76 port 2 (p2) ............................................................................................................................... ........................ 77 port 5 (p5) ............................................................................................................................... ........................ 81 port 6 (p6) ............................................................................................................................... ........................ 82 .com .com .com .com 4 .com u datasheet
appendix c register index users manual u14643ej1v0um00 260 port mode register 0 (pm0) ............................................................................................................................ 83 port mode register 1 (pm1) ............................................................................................................................ 83 port mode register 2 (pm2) ........................................................................................................... 83, 109, 119 port mode register 5 (pm5) ............................................................................................................................ 83 processor clock control register (pcc) ................................................................................................... 88, 96 pull-up resistor option register 0 (pu0) ......................................................................................................... 84 pull-up resistor option register b2 (pub2) .................................................................................................... 84 [r] receive buffer register 20 (rxb20) ............................................................................................................. 166 [s] serial operating mode register 20 (csim20) ...................................................................... 167, 174, 177, 189 [t] timer clock select register 2 (tcl2) ............................................................................................................ 131 transmit shift register 20 (txs20) ............................................................................................................... 166 [w] watchdog timer mode register (wdtm) ...................................................................................................... 132 .com .com .com .com 4 .com u datasheet
appendix c register index users manual u14643ej1v0um00 261 c.2 register symbol index (alphabetic order) [a] adcr0: a/d conversion result register 0 ................................................................................................ 136 adm0: a/d converter mode register 0 .................................................................................................. 138 ads0: analog input channel specification register 0 ........................................................................... 139 asim20: asynchronous serial interface mode register 20 ............................................. 168, 175, 178, 190 asis20: asynchronous serial interface status register 20 .............................................................. 170, 179 [b] brgc20: baud rate generator control register 20 ................................................................... 171, 180, 191 [c] cr20: 16-bit compare register 20 ......................................................................................................... 106 cr80: 8- bit compare register 80 .......................................................................................................... 117 csim20: serial operating mode register 20 .................................................................... 167, 174, 177, 189 [i] if0: interrupt request flag register 0 ................................................................................................. 207 if1: interrupt request flag register 1 ................................................................................................. 207 intm0: external interrupt mode register 0 ............................................................................................. 209 [m] mk0: interrupt mask flag register 0 ..................................................................................................... 208 mk1: interrupt mask flag register 1 ..................................................................................................... 208 mra0: multiplication data register a0 ................................................................................................... 199 mrb0: multiplication data register b0 ................................................................................................... 199 mul0: 16-bit multiplication result storage register 0 ............................................................................ 199 mulc0: multiplier control register 0 ........................................................................................................ 201 [o] osts: oscillation stabilization time select register .............................................................................. 220 [p] p0: port 0 ............................................................................................................................... ............. 75 p1: port 1 ............................................................................................................................... ............. 76 p2: port 2 ............................................................................................................................... ............. 77 p5: port 5 ............................................................................................................................... ............. 81 p6: port 6 ............................................................................................................................... ............. 82 pcc: processor clock control register ............................................................................................ 88, 96 pm0: port mode register 0 .................................................................................................................... 83 pm1: port mode register 1 .................................................................................................................... 83 pm2: port mode register 2 ................................................................................................... 83, 109, 119 pm5: port mode register 5 .................................................................................................................... 83 pu0: pull-up resistor option register 0 ................................................................................................. 84 pub2: pull-up resistor option register b2 ............................................................................................... 84 .com .com .com .com 4 .com u datasheet
appendix c register index users manual u14643ej1v0um00 262 [r] rxb20: receive buffer register 20 .......................................................................................................... 166 [t] tcl2: timer clock select register 2 ...................................................................................................... 131 tcp20: 16-bit timer capture register 20 ................................................................................................. 106 tm20: 16-bit timer counter 20 ............................................................................................................... 106 tm80: 8-bit timer counter 80 ................................................................................................................. 117 tmc20: 16-bit timer mode control register 20 ........................................................................................ 116 tmc80: 8-bit timer mode control register 80 .......................................................................................... 118 txs20: transmit shift register 20 ........................................................................................................... 166 [w] wdtm: watchdog timer mode register .................................................................................................. 132 .com .com .com .com 4 .com u datasheet
although nec has taken all possible steps to ensure that the documentation supplied to our customers is complete, bug free and up-to-date, we readily accept that errors may occur. despite all the care and precautions we?e taken, you may encounter problems in the documentation. please complete this form whenever youd like to report errors or suggest improvements to us. hong kong, philippines, oceania nec electronics hong kong ltd. fax: +852-2886-9022/9044 korea nec electronics hong kong ltd. seoul branch fax: 02-528-4411 taiwan nec electronics taiwan ltd. fax: 02-2719-5951 address north america nec electronics inc. corporate communications dept. fax: 1-800-729-9288 1-408-588-6130 europe nec electronics (europe) gmbh technical documentation dept. fax: +49-211-6503-274 south america nec do brasil s.a. fax: +55-11-6465-6829 asian nations except philippines nec electronics singapore pte. ltd. fax: +65-250-3583 japan nec semiconductor technical hotline fax: 044-548-7900 i would like to report the following error/make the following suggestion: document title: document number: page number: thank you for your kind support. if possible, please fax the referenced page or drawing. excellent good acceptable poor document rating clarity technical accuracy organization cs 99.1 name company from: tel. fax facsimile message .com .com .com 4 .com u datasheet


▲Up To Search▲   

 
Price & Availability of 78F9116A

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X